chushihua
This commit is contained in:
+37
@@ -0,0 +1,37 @@
|
||||
const doc = (typeof document === 'undefined') ? {
|
||||
body: {},
|
||||
addEventListener() {},
|
||||
removeEventListener() {},
|
||||
activeElement: {
|
||||
blur() {},
|
||||
nodeName: '',
|
||||
},
|
||||
querySelector() {
|
||||
return null;
|
||||
},
|
||||
querySelectorAll() {
|
||||
return [];
|
||||
},
|
||||
getElementById() {
|
||||
return null;
|
||||
},
|
||||
createEvent() {
|
||||
return {
|
||||
initEvent() {},
|
||||
};
|
||||
},
|
||||
createElement() {
|
||||
return {
|
||||
children: [],
|
||||
childNodes: [],
|
||||
style: {},
|
||||
setAttribute() {},
|
||||
getElementsByTagName() {
|
||||
return [];
|
||||
},
|
||||
};
|
||||
},
|
||||
location: { hash: '' },
|
||||
} : document; // eslint-disable-line
|
||||
|
||||
export default doc;
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
import document from './document';
|
||||
import window from './window';
|
||||
|
||||
export { window, document };
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
import document from './document';
|
||||
|
||||
const win = (typeof window === 'undefined') ? {
|
||||
document,
|
||||
navigator: {
|
||||
userAgent: '',
|
||||
},
|
||||
location: {},
|
||||
history: {},
|
||||
CustomEvent: function CustomEvent() {
|
||||
return this;
|
||||
},
|
||||
addEventListener() {},
|
||||
removeEventListener() {},
|
||||
getComputedStyle() {
|
||||
return {
|
||||
getPropertyValue() {
|
||||
return '';
|
||||
},
|
||||
};
|
||||
},
|
||||
Image() {},
|
||||
Date() {},
|
||||
screen: {},
|
||||
setTimeout() {},
|
||||
clearTimeout() {},
|
||||
} : window; // eslint-disable-line
|
||||
|
||||
export default win;
|
||||
Reference in New Issue
Block a user