Skip to content

Commit

Permalink
Merge pull request #14 from Pauan/master
Browse files Browse the repository at this point in the history
Moving module.exports to the top level
  • Loading branch information
Raynos committed Apr 18, 2017
2 parents 65eb66c + 02428b7 commit f187874
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
10 changes: 6 additions & 4 deletions document.js
Expand Up @@ -2,14 +2,16 @@ var topLevel = typeof global !== 'undefined' ? global :
typeof window !== 'undefined' ? window : {}
var minDoc = require('min-document');

var doccy;

if (typeof document !== 'undefined') {
module.exports = document;
doccy = document;
} else {
var doccy = topLevel['__GLOBAL_DOCUMENT_CACHE@4'];
doccy = topLevel['__GLOBAL_DOCUMENT_CACHE@4'];

if (!doccy) {
doccy = topLevel['__GLOBAL_DOCUMENT_CACHE@4'] = minDoc;
}

module.exports = doccy;
}

module.exports = doccy;
12 changes: 8 additions & 4 deletions window.js
@@ -1,9 +1,13 @@
var win;

if (typeof window !== "undefined") {
module.exports = window;
win = window;
} else if (typeof global !== "undefined") {
module.exports = global;
win = global;
} else if (typeof self !== "undefined"){
module.exports = self;
win = self;
} else {
module.exports = {};
win = {};
}

module.exports = win;

0 comments on commit f187874

Please sign in to comment.