We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0b8e6b8 commit f0c7c42Copy full SHA for f0c7c42
src/globalthis.js
@@ -0,0 +1,20 @@
1
+/* eslint-disable no-undef */
2
+/* eslint-disable no-extend-native */
3
+/* eslint-disable strict */
4
+
5
+// polyfill for globalThis
6
+// https://v8.dev/features/globalthis
7
+// https://mathiasbynens.be/notes/globalthis
8
+(function () {
9
+ if (typeof globalThis === 'object') return
10
+ Object.defineProperty(Object.prototype, '__magic__', {
11
+ get: function () {
12
+ return this
13
+ },
14
+ configurable: true
15
+ })
16
+ __magic__.globalThis = __magic__
17
+ delete Object.prototype.__magic__
18
+}())
19
20
+module.exports = globalThis
0 commit comments