Browse Source

Convert to class

pull/2/head
Luke Childs 8 years ago
parent
commit
ef09db4c24
  1. 8
      src/index.js

8
src/index.js

@ -1,7 +1,11 @@
const jsdom = require('jsdom'); const jsdom = require('jsdom');
// Function to return a window object. // Class to return a window instance.
// Accepts a jsdom config object. // Accepts a jsdom config object.
// Config object must be cloned before passing through otherwise jsdom will add // Config object must be cloned before passing through otherwise jsdom will add
// lots of properties to the original reference. // lots of properties to the original reference.
module.exports = (jsdomConfig = {}) => jsdom.jsdom('', Object.assign({}, jsdomConfig)).defaultView; module.exports = class Window {
constructor(jsdomConfig) {
return jsdom.jsdom('', Object.assign({}, jsdomConfig)).defaultView;
}
};

Loading…
Cancel
Save