aboutsummaryrefslogtreecommitdiff
path: root/client-web/source
diff options
context:
space:
mode:
Diffstat (limited to 'client-web/source')
-rw-r--r--client-web/source/sw/download_stream.ts1
-rw-r--r--client-web/source/sw/worker.ts5
2 files changed, 2 insertions, 4 deletions
diff --git a/client-web/source/sw/download_stream.ts b/client-web/source/sw/download_stream.ts
index 4eaf382..2a8049d 100644
--- a/client-web/source/sw/download_stream.ts
+++ b/client-web/source/sw/download_stream.ts
@@ -46,7 +46,6 @@ export function StreamDownload(size: number, filename?: string, progress?: (posi
const reader = new FileReader();
reader.onload = function (event) {
const arr = new Uint8Array(event.target!.result as ArrayBuffer);
- console.log("send", arr);
port1.postMessage(arr)
position += arr.length
if (progress) progress(position)
diff --git a/client-web/source/sw/worker.ts b/client-web/source/sw/worker.ts
index 25f6bab..5c185f3 100644
--- a/client-web/source/sw/worker.ts
+++ b/client-web/source/sw/worker.ts
@@ -47,12 +47,11 @@ function port_to_readable(port: MessagePort): ReadableStream {
return new ReadableStream({
start(controller) {
console.log("ReadableStream started");
- port.addEventListener("message", event => {
- console.log(event.data);
+ port.onmessage = event => {
if (event.data === "end") { controller.close() }
else if (event.data === "abort") controller.error("aborted")
else controller.enqueue(event.data)
- })
+ }
},
cancel() { console.log("ReadableStream cancelled"); port.postMessage({ abort: true }) },
})