From ff774a54579052e295e8f8a963faf29368177b74 Mon Sep 17 00:00:00 2001 From: Jakob Linskeseder Date: Wed, 19 Oct 2022 22:28:46 +0200 Subject: [PATCH] Make library compatible with workers Pulled from 4.x branch, see #1894. --- lib/handlebars/no-conflict.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/handlebars/no-conflict.js b/lib/handlebars/no-conflict.js index c19ced36..bfd8a41b 100644 --- a/lib/handlebars/no-conflict.js +++ b/lib/handlebars/no-conflict.js @@ -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; };