From 43895e018d4842108513eecbee38cc1113c57998 Mon Sep 17 00:00:00 2001 From: chocolateboy Date: Wed, 12 Aug 2020 13:00:03 +0000 Subject: [PATCH] Add globalThis check to the globalThis ponyfill (#16) --- browser.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/browser.js b/browser.js index 462f422..0b43374 100644 --- a/browser.js +++ b/browser.js @@ -1,8 +1,13 @@ /* eslint-env browser */ +/* global globalThis:readonly */ 'use strict'; // Ponyfill for `globalThis` const _globalThis = (() => { + if (typeof globalThis !== 'undefined') { + return globalThis; + } + if (typeof self !== 'undefined') { return self; }