From 54b133f466d5e2d2675a20126e8c4b7bf1dce6f2 Mon Sep 17 00:00:00 2001 From: Gildas Date: Sat, 27 Jan 2024 22:59:07 +0100 Subject: [PATCH] call handlers with `await` --- lib/core/codec-worker.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/core/codec-worker.js b/lib/core/codec-worker.js index bad4c8df..59f04ef7 100644 --- a/lib/core/codec-worker.js +++ b/lib/core/codec-worker.js @@ -100,9 +100,9 @@ class ProgressWatcherStream extends TransformStream { constructor(readableSource, { onstart, onprogress, size, onend }) { let chunkOffset = 0; super({ - start() { + async start() { if (onstart) { - callHandler(onstart, size); + await callHandler(onstart, size); } }, async transform(chunk, controller) { @@ -112,10 +112,10 @@ class ProgressWatcherStream extends TransformStream { } controller.enqueue(chunk); }, - flush() { + async flush() { readableSource.size = chunkOffset; if (onend) { - callHandler(onend, chunkOffset); + await callHandler(onend, chunkOffset); } } });