Skip to content

Commit 4ab9996

Browse files
committed
Avoid caching variables that might be collected and fail later on
1 parent 9a535f8 commit 4ab9996

File tree

4 files changed

+7
-8
lines changed

4 files changed

+7
-8
lines changed

docs/index.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/index.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

esm/worker/_template.js

+4-5
Original file line numberDiff line numberDiff line change
@@ -122,11 +122,10 @@ add('message', ({ data: { options, config: baseURL, configURL, code, hooks } })
122122

123123
// there's no way to query the DOM, use foreign CustomEvent and so on
124124
// in case there's no SharedArrayBuffer around.
125-
let CustomEvent, document, notify, currentScript = null, target = '';
125+
let notify, currentScript = null, target = '';
126126
if (syncMainAndWorker) {
127-
({ CustomEvent, document } = window);
128-
currentScript = id && document.getElementById(id) || null;
129-
notify = kind => dispatch(currentScript, custom || type, kind, true, CustomEvent);
127+
currentScript = id && window.document.getElementById(id) || null;
128+
notify = kind => dispatch(currentScript, custom || type, kind, true, window.CustomEvent);
130129
}
131130

132131
// TODO: even this is problematic without SharedArrayBuffer
@@ -143,7 +142,7 @@ add('message', ({ data: { options, config: baseURL, configURL, code, hooks } })
143142
if (!target && currentScript) {
144143
if (tag === 'SCRIPT') {
145144
currentScript.after(assign(
146-
document.createElement(`script-${custom || type}`),
145+
window.document.createElement(`script-${custom || type}`),
147146
{ id: (target = `${id}-target`) }
148147
));
149148
}

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,6 @@
8686
"to-json-callback": "^0.1.1"
8787
},
8888
"worker": {
89-
"blob": "sha256-SYp37rM5lEJb2jwMKsu7YFF3j5ggR1eZxAP4eW06tqY="
89+
"blob": "sha256-tgJwlipNdA+alH1VirlPwq87PFbjdxaVJ6OpJflekE0="
9090
}
9191
}

0 commit comments

Comments
 (0)