Selaa lähdekoodia

basis: only remove event handler if it matches the actionId

Trevor Baron 6 vuotta sitten
vanhempi
commit
d9003f2f82
1 muutettua tiedostoa jossa 3 lisäystä ja 1 poistoa
  1. 3 1
      src/Misc/basis.ts

+ 3 - 1
src/Misc/basis.ts

@@ -159,8 +159,8 @@ export class BasisTools {
             this._CreateWorkerAsync().then(() => {
                 var actionId = this._actionId++;
                 var messageHandler = (msg: any) => {
-                    this._Worker!.removeEventListener("message", messageHandler);
                     if (msg.data.action === "transcode" && msg.data.id === actionId) {
+                        this._Worker!.removeEventListener("message", messageHandler);
                         if (!msg.data.success) {
                             rej("Transcode is not supported on this device");
                         }else {
@@ -316,6 +316,8 @@ function workerFunc(): void {
             if (needsConversion) {
                 format = -1;
             }
+
+            debugger
             if (!success) {
                 postMessage({action: "transcode", success: success, id: event.data.id});
             }else {