chushihua
This commit is contained in:
+74
@@ -0,0 +1,74 @@
|
||||
/**
|
||||
* SSR Window 1.0.1
|
||||
* Better handling for window object in SSR environment
|
||||
* https://github.com/nolimits4web/ssr-window
|
||||
*
|
||||
* Copyright 2018, Vladimir Kharlampidi
|
||||
*
|
||||
* Licensed under MIT
|
||||
*
|
||||
* Released on: July 18, 2018
|
||||
*/
|
||||
var doc = (typeof document === 'undefined') ? {
|
||||
body: {},
|
||||
addEventListener: function addEventListener() {},
|
||||
removeEventListener: function removeEventListener() {},
|
||||
activeElement: {
|
||||
blur: function blur() {},
|
||||
nodeName: '',
|
||||
},
|
||||
querySelector: function querySelector() {
|
||||
return null;
|
||||
},
|
||||
querySelectorAll: function querySelectorAll() {
|
||||
return [];
|
||||
},
|
||||
getElementById: function getElementById() {
|
||||
return null;
|
||||
},
|
||||
createEvent: function createEvent() {
|
||||
return {
|
||||
initEvent: function initEvent() {},
|
||||
};
|
||||
},
|
||||
createElement: function createElement() {
|
||||
return {
|
||||
children: [],
|
||||
childNodes: [],
|
||||
style: {},
|
||||
setAttribute: function setAttribute() {},
|
||||
getElementsByTagName: function getElementsByTagName() {
|
||||
return [];
|
||||
},
|
||||
};
|
||||
},
|
||||
location: { hash: '' },
|
||||
} : document; // eslint-disable-line
|
||||
|
||||
var win = (typeof window === 'undefined') ? {
|
||||
document: doc,
|
||||
navigator: {
|
||||
userAgent: '',
|
||||
},
|
||||
location: {},
|
||||
history: {},
|
||||
CustomEvent: function CustomEvent() {
|
||||
return this;
|
||||
},
|
||||
addEventListener: function addEventListener() {},
|
||||
removeEventListener: function removeEventListener() {},
|
||||
getComputedStyle: function getComputedStyle() {
|
||||
return {
|
||||
getPropertyValue: function getPropertyValue() {
|
||||
return '';
|
||||
},
|
||||
};
|
||||
},
|
||||
Image: function Image() {},
|
||||
Date: function Date() {},
|
||||
screen: {},
|
||||
setTimeout: function setTimeout() {},
|
||||
clearTimeout: function clearTimeout() {},
|
||||
} : window; // eslint-disable-line
|
||||
|
||||
export { win as window, doc as document };
|
||||
+85
@@ -0,0 +1,85 @@
|
||||
/**
|
||||
* SSR Window 1.0.1
|
||||
* Better handling for window object in SSR environment
|
||||
* https://github.com/nolimits4web/ssr-window
|
||||
*
|
||||
* Copyright 2018, Vladimir Kharlampidi
|
||||
*
|
||||
* Licensed under MIT
|
||||
*
|
||||
* Released on: July 18, 2018
|
||||
*/
|
||||
(function (global, factory) {
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
||||
typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
||||
(factory((global.ssrWindow = {})));
|
||||
}(this, (function (exports) { 'use strict';
|
||||
|
||||
var doc = (typeof document === 'undefined') ? {
|
||||
body: {},
|
||||
addEventListener: function addEventListener() {},
|
||||
removeEventListener: function removeEventListener() {},
|
||||
activeElement: {
|
||||
blur: function blur() {},
|
||||
nodeName: '',
|
||||
},
|
||||
querySelector: function querySelector() {
|
||||
return null;
|
||||
},
|
||||
querySelectorAll: function querySelectorAll() {
|
||||
return [];
|
||||
},
|
||||
getElementById: function getElementById() {
|
||||
return null;
|
||||
},
|
||||
createEvent: function createEvent() {
|
||||
return {
|
||||
initEvent: function initEvent() {},
|
||||
};
|
||||
},
|
||||
createElement: function createElement() {
|
||||
return {
|
||||
children: [],
|
||||
childNodes: [],
|
||||
style: {},
|
||||
setAttribute: function setAttribute() {},
|
||||
getElementsByTagName: function getElementsByTagName() {
|
||||
return [];
|
||||
},
|
||||
};
|
||||
},
|
||||
location: { hash: '' },
|
||||
} : document; // eslint-disable-line
|
||||
|
||||
var win = (typeof window === 'undefined') ? {
|
||||
document: doc,
|
||||
navigator: {
|
||||
userAgent: '',
|
||||
},
|
||||
location: {},
|
||||
history: {},
|
||||
CustomEvent: function CustomEvent() {
|
||||
return this;
|
||||
},
|
||||
addEventListener: function addEventListener() {},
|
||||
removeEventListener: function removeEventListener() {},
|
||||
getComputedStyle: function getComputedStyle() {
|
||||
return {
|
||||
getPropertyValue: function getPropertyValue() {
|
||||
return '';
|
||||
},
|
||||
};
|
||||
},
|
||||
Image: function Image() {},
|
||||
Date: function Date() {},
|
||||
screen: {},
|
||||
setTimeout: function setTimeout() {},
|
||||
clearTimeout: function clearTimeout() {},
|
||||
} : window; // eslint-disable-line
|
||||
|
||||
exports.window = win;
|
||||
exports.document = doc;
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
})));
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
/**
|
||||
* SSR Window 1.0.1
|
||||
* Better handling for window object in SSR environment
|
||||
* https://github.com/nolimits4web/ssr-window
|
||||
*
|
||||
* Copyright 2018, Vladimir Kharlampidi
|
||||
*
|
||||
* Licensed under MIT
|
||||
*
|
||||
* Released on: July 18, 2018
|
||||
*/!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n(e.ssrWindow={})}(this,function(e){"use strict";var n="undefined"==typeof document?{body:{},addEventListener:function(){},removeEventListener:function(){},activeElement:{blur:function(){},nodeName:""},querySelector:function(){return null},querySelectorAll:function(){return[]},getElementById:function(){return null},createEvent:function(){return{initEvent:function(){}}},createElement:function(){return{children:[],childNodes:[],style:{},setAttribute:function(){},getElementsByTagName:function(){return[]}}},location:{hash:""}}:document,t="undefined"==typeof window?{document:n,navigator:{userAgent:""},location:{},history:{},CustomEvent:function(){return this},addEventListener:function(){},removeEventListener:function(){},getComputedStyle:function(){return{getPropertyValue:function(){return""}}},Image:function(){},Date:function(){},screen:{},setTimeout:function(){},clearTimeout:function(){}}:window;e.window=t,e.document=n,Object.defineProperty(e,"__esModule",{value:!0})});
|
||||
//# sourceMappingURL=ssr-window.min.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["ssr-window.js"],"names":["global","factory","exports","module","define","amd","ssrWindow","this","doc","document","body","addEventListener","removeEventListener","activeElement","blur","nodeName","querySelector","querySelectorAll","getElementById","createEvent","initEvent","createElement","children","childNodes","style","setAttribute","getElementsByTagName","location","hash","win","window","navigator","userAgent","history","CustomEvent","getComputedStyle","getPropertyValue","Image","Date","screen","setTimeout","clearTimeout","Object","defineProperty","value"],"mappings":";;;;;;;;;;IAWC,SAAUA,EAAQC,GACC,iBAAZC,SAA0C,oBAAXC,OAAyBF,EAAQC,SACrD,mBAAXE,QAAyBA,OAAOC,IAAMD,QAAQ,WAAYH,GAChEA,EAASD,EAAOM,cAHlB,CAIEC,KAAM,SAAWL,GAAW,aAE9B,IAAIM,EAA2B,oBAAbC,UAChBC,QACAC,iBAAkB,aAClBC,oBAAqB,aACrBC,eACEC,KAAM,aACNC,SAAU,IAEZC,cAAe,WACb,OAAO,MAETC,iBAAkB,WAChB,UAEFC,eAAgB,WACd,OAAO,MAETC,YAAa,WACX,OACEC,UAAW,eAGfC,cAAe,WACb,OACEC,YACAC,cACAC,SACAC,aAAc,aACdC,qBAAsB,WACpB,YAINC,UAAYC,KAAM,KAChBnB,SAEAoB,EAAyB,oBAAXC,QAChBrB,SAAUD,EACVuB,WACEC,UAAW,IAEbL,YACAM,WACAC,YAAa,WACX,OAAO3B,MAETI,iBAAkB,aAClBC,oBAAqB,aACrBuB,iBAAkB,WAChB,OACEC,iBAAkB,WAChB,MAAO,MAIbC,MAAO,aACPC,KAAM,aACNC,UACAC,WAAY,aACZC,aAAc,cACZX,OAEJ5B,EAAQ4B,OAASD,EACjB3B,EAAQO,SAAWD,EAEnBkC,OAAOC,eAAezC,EAAS,cAAgB0C,OAAO","file":"ssr-window.min.js","sourcesContent":["/**\n * SSR Window 1.0.1\n * Better handling for window object in SSR environment\n * https://github.com/nolimits4web/ssr-window\n *\n * Copyright 2018, Vladimir Kharlampidi\n *\n * Licensed under MIT\n *\n * Released on: July 18, 2018\n */\n(function (global, factory) {\n\ttypeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :\n\ttypeof define === 'function' && define.amd ? define(['exports'], factory) :\n\t(factory((global.ssrWindow = {})));\n}(this, (function (exports) { 'use strict';\n\nvar doc = (typeof document === 'undefined') ? {\n body: {},\n addEventListener: function addEventListener() {},\n removeEventListener: function removeEventListener() {},\n activeElement: {\n blur: function blur() {},\n nodeName: '',\n },\n querySelector: function querySelector() {\n return null;\n },\n querySelectorAll: function querySelectorAll() {\n return [];\n },\n getElementById: function getElementById() {\n return null;\n },\n createEvent: function createEvent() {\n return {\n initEvent: function initEvent() {},\n };\n },\n createElement: function createElement() {\n return {\n children: [],\n childNodes: [],\n style: {},\n setAttribute: function setAttribute() {},\n getElementsByTagName: function getElementsByTagName() {\n return [];\n },\n };\n },\n location: { hash: '' },\n} : document; // eslint-disable-line\n\nvar win = (typeof window === 'undefined') ? {\n document: doc,\n navigator: {\n userAgent: '',\n },\n location: {},\n history: {},\n CustomEvent: function CustomEvent() {\n return this;\n },\n addEventListener: function addEventListener() {},\n removeEventListener: function removeEventListener() {},\n getComputedStyle: function getComputedStyle() {\n return {\n getPropertyValue: function getPropertyValue() {\n return '';\n },\n };\n },\n Image: function Image() {},\n Date: function Date() {},\n screen: {},\n setTimeout: function setTimeout() {},\n clearTimeout: function clearTimeout() {},\n} : window; // eslint-disable-line\n\nexports.window = win;\nexports.document = doc;\n\nObject.defineProperty(exports, '__esModule', { value: true });\n\n})));\n"]}
|
||||
Reference in New Issue
Block a user