Browse Source

Add param to choose globals

pull/2/head
Luke Childs 9 years ago
parent
commit
68ab0bafe6
  1. 5
      src/index.js

5
src/index.js

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

Loading…
Cancel
Save