Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

Commit

Permalink
feat: add globalThis polyfill
Browse files Browse the repository at this point in the history
  • Loading branch information
hugomrdias committed Jul 18, 2019
1 parent 0b8e6b8 commit f0c7c42
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/globalthis.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/* eslint-disable no-undef */
/* eslint-disable no-extend-native */
/* eslint-disable strict */

// polyfill for globalThis
// https://v8.dev/features/globalthis
// https://mathiasbynens.be/notes/globalthis
(function () {
if (typeof globalThis === 'object') return
Object.defineProperty(Object.prototype, '__magic__', {
get: function () {
return this
},
configurable: true
})
__magic__.globalThis = __magic__
delete Object.prototype.__magic__
}())

module.exports = globalThis

0 comments on commit f0c7c42

Please sign in to comment.