Make library compatible with workers

Pulled from 4.x branch, see #1894.
This commit is contained in:
Jakob Linskeseder
2022-10-19 22:28:46 +02:00
committed by Jay Linski
parent 03fe783a69
commit 6186128ad0
+4 -5
View File
@@ -1,11 +1,10 @@
export default function (Handlebars) {
/* istanbul ignore next */
let root = typeof global !== 'undefined' ? global : window, // eslint-disable-line no-undef
$Handlebars = root.Handlebars;
let $Handlebars = globalThis.Handlebars;
/* istanbul ignore next */
Handlebars.noConflict = function () {
if (root.Handlebars === Handlebars) {
root.Handlebars = $Handlebars;
if (globalThis.Handlebars === Handlebars) {
globalThis.Handlebars = $Handlebars;
}
return Handlebars;
};