Skip to content

Commit 6fad436

Browse files
committed
Size optimizations
1 parent 08649eb commit 6fad436

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/index.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,14 @@
2020
export default function workerize(code, options) {
2121
let exports = {};
2222
let exportsObjName = `__xpo${Math.random().toString().substring(2)}__`;
23-
let blob = new Blob([code], {
24-
type: 'application/javascript'
25-
}),
26-
url = URL.createObjectURL(blob),
2723
if (typeof code==='function') code = `(${Function.prototype.toString.call(code)})(${exportsObjName})`;
2824
code = toCjs(code, exportsObjName, exports) + `\n(${Function.prototype.toString.call(setup)})(self,${exportsObjName},{})`;
25+
let url = URL.createObjectURL(new Blob([code])),
2926
worker = new Worker(url, options),
3027
term = worker.terminate,
28+
callbacks = {},
3129
counter = 0,
32-
callbacks = {};
30+
i;
3331
worker.kill = signal => {
3432
worker.postMessage({ type: 'KILL', signal });
3533
setTimeout(worker.terminate);

0 commit comments

Comments
 (0)