Skip to content

Commit

Permalink
fix(ua): Fix the side-effect by refactoring (#898)
Browse files Browse the repository at this point in the history
Update on getting global
Side-effect caused by: 9d6de8
  • Loading branch information
netil committed May 24, 2019
1 parent 35754ca commit d00d903
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/internals/browser.js
Expand Up @@ -7,9 +7,13 @@
* @module
* @ignore
*/
/* eslint-disable no-undef */
const win = globalThis || window || self || global;
/* eslint-enable no-undef */
/* eslint-disable no-new-func, no-undef */
const win = (() => {
const def = o => typeof o !== "undefined" && o;

return def(self) || def(window) || def(global) || def(globalThis) || Function("return this")();
})();
/* eslint-enable no-new-func, no-undef */

const doc = win && win.document;

Expand Down

0 comments on commit d00d903

Please sign in to comment.