|
@ -1,10 +1,13 @@ |
|
|
import { jsdom } from 'jsdom'; |
|
|
import { jsdom } from 'jsdom'; |
|
|
|
|
|
|
|
|
module.exports = () => { |
|
|
module.exports = (props) => { |
|
|
const window = jsdom('<html><body></body></html>').defaultView; |
|
|
const window = jsdom('<html><body></body></html>').defaultView; |
|
|
|
|
|
|
|
|
Object.keys(window).forEach(prop => { |
|
|
Object.keys(window).forEach(prop => { |
|
|
if(typeof global[prop] === 'undefined') { |
|
|
if(typeof global[prop] === 'undefined') { |
|
|
|
|
|
if(props instanceof Array && props.indexOf(prop) === -1) { |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
global[prop] = window[prop]; |
|
|
global[prop] = window[prop]; |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|