-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: fix globalThis polyfill in loading snippet
- Loading branch information
1 parent
e63bbe6
commit 389ad8f
Showing
15 changed files
with
309 additions
and
173 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -95,16 +95,28 @@ | |
src="https://polyfill-fastly.io/v3/polyfill.min.js?version=3.111.0&features=Symbol%2CPromise%2CglobalThis" | ||
></script> | ||
<script> | ||
if (typeof globalThis === 'undefined') { | ||
Object.defineProperty(Object.prototype, '__globalThis_magic__', { | ||
get: function get() { | ||
return this; | ||
}, | ||
configurable: true | ||
}); | ||
__globalThis_magic__.globalThis = __globalThis_magic__; | ||
delete Object.prototype.__globalThis_magic__; | ||
} | ||
(function() { | ||
if (typeof globalThis === "undefined") { | ||
var getGlobal = function() { | ||
if (typeof self !== "undefined") { | ||
return self; | ||
} | ||
if (typeof window !== "undefined") { | ||
return window; | ||
} | ||
return null; | ||
}; | ||
|
||
var global = getGlobal(); | ||
|
||
if (global) { | ||
Object.defineProperty(global, 'globalThis', { | ||
value: global, | ||
configurable: true | ||
}); | ||
} | ||
} | ||
})(); | ||
</script> | ||
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/clipboard.min.js"></script> | ||
<style> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -95,16 +95,28 @@ | |
src="https://polyfill-fastly.io/v3/polyfill.min.js?version=3.111.0&features=Symbol%2CPromise%2CglobalThis" | ||
></script> | ||
<script> | ||
if (typeof globalThis === 'undefined') { | ||
Object.defineProperty(Object.prototype, '__globalThis_magic__', { | ||
get: function get() { | ||
return this; | ||
}, | ||
configurable: true | ||
}); | ||
__globalThis_magic__.globalThis = __globalThis_magic__; | ||
delete Object.prototype.__globalThis_magic__; | ||
} | ||
(function() { | ||
if (typeof globalThis === "undefined") { | ||
var getGlobal = function() { | ||
if (typeof self !== "undefined") { | ||
return self; | ||
} | ||
if (typeof window !== "undefined") { | ||
return window; | ||
} | ||
return null; | ||
}; | ||
|
||
var global = getGlobal(); | ||
|
||
if (global) { | ||
Object.defineProperty(global, 'globalThis', { | ||
value: global, | ||
configurable: true | ||
}); | ||
} | ||
} | ||
})(); | ||
</script> | ||
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/clipboard.min.js"></script> | ||
<style> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -81,16 +81,28 @@ | |
src="https://polyfill-fastly.io/v3/polyfill.min.js?version=3.111.0&features=Symbol%2CPromise%2CglobalThis" | ||
></script> | ||
<script> | ||
if (typeof globalThis === 'undefined') { | ||
Object.defineProperty(Object.prototype, '__globalThis_magic__', { | ||
get: function get() { | ||
return this; | ||
}, | ||
configurable: true | ||
}); | ||
__globalThis_magic__.globalThis = __globalThis_magic__; | ||
delete Object.prototype.__globalThis_magic__; | ||
} | ||
(function() { | ||
if (typeof globalThis === "undefined") { | ||
var getGlobal = function() { | ||
if (typeof self !== "undefined") { | ||
return self; | ||
} | ||
if (typeof window !== "undefined") { | ||
return window; | ||
} | ||
return null; | ||
}; | ||
|
||
var global = getGlobal(); | ||
|
||
if (global) { | ||
Object.defineProperty(global, 'globalThis', { | ||
value: global, | ||
configurable: true | ||
}); | ||
} | ||
} | ||
})(); | ||
</script> | ||
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/clipboard.min.js"></script> | ||
<style> | ||
|
Oops, something went wrong.