aboutsummaryrefslogtreecommitdiffstats
path: root/src/routes/ts-worker.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/routes/ts-worker.ts')
-rw-r--r--src/routes/ts-worker.ts11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/routes/ts-worker.ts b/src/routes/ts-worker.ts
new file mode 100644
index 0000000..460885c
--- /dev/null
+++ b/src/routes/ts-worker.ts
@@ -0,0 +1,11 @@
+export default (async () => {
+ const contents = new TextDecoder().decode(
+ (await (await import('brotli-wasm')).default).decompress(
+ await fetch('./generated/ts-worker.js.br')
+ .then((v) => v.arrayBuffer())
+ .then((v) => new Uint8Array(v))
+ )
+ );
+ const worker = new Worker(`data:text/javascript;base64,${btoa(contents)}`);
+ return worker;
+})();