Skip to content

Commit

Permalink
Make library compatible with workers
Browse files Browse the repository at this point in the history
Pulled from 4.x branch, see #1894.
  • Loading branch information
jaylinski committed Oct 19, 2022
1 parent 1cf26de commit 5425f03
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions lib/handlebars/no-conflict.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
export default function(Handlebars) {
export default function (Handlebars) {
let $Handlebars = globalThis.Handlebars;

/* istanbul ignore next */
let root = typeof global !== 'undefined' ? global : window, // eslint-disable-line no-undef
$Handlebars = root.Handlebars;
/* istanbul ignore next */
Handlebars.noConflict = function() {
if (root.Handlebars === Handlebars) {
root.Handlebars = $Handlebars;
Handlebars.noConflict = function () {
if (globalThis.Handlebars === Handlebars) {
globalThis.Handlebars = $Handlebars;
}
return Handlebars;
};
Expand Down

0 comments on commit 5425f03

Please sign in to comment.