Skip to content

Commit

Permalink
call handlers with await
Browse files Browse the repository at this point in the history
  • Loading branch information
gildas-lormeau committed Jan 27, 2024
1 parent 4bd65d1 commit 54b133f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/core/codec-worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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);
}
}
});
Expand Down

0 comments on commit 54b133f

Please sign in to comment.