mirror of https://github.com/lukechilds/window.git
1 changed files with 6 additions and 2 deletions
@ -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…
Reference in new issue