@microblink/capture 1.1.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  var Module = {};
3
3
  var initializedJS = false;
4
- var pendingNotifiedProxyingQueues = [];
5
4
  function threadPrintErr() {
6
5
  var text = Array.prototype.slice.call(arguments).join(" ");
7
6
  console.error(text);
@@ -23,7 +22,7 @@ Module["instantiateWasm"] = (info, receiveInstance) => {
23
22
  return receiveInstance(instance);
24
23
  };
25
24
  self.onunhandledrejection = (e) => {
26
- throw e.reason ?? e;
25
+ throw e.reason || e;
27
26
  };
28
27
  function handleMessage(e) {
29
28
  try {
@@ -40,12 +39,8 @@ function handleMessage(e) {
40
39
  };
41
40
  Module["wasmModule"] = e.data.wasmModule;
42
41
  for (const handler of e.data.handlers) {
43
- Module[handler] = function () {
44
- postMessage({
45
- cmd: "callHandler",
46
- handler: handler,
47
- args: [...arguments],
48
- });
42
+ Module[handler] = (...args) => {
43
+ postMessage({ cmd: "callHandler", handler: handler, args: args });
49
44
  };
50
45
  }
51
46
  Module["wasmMemory"] = e.data.wasmMemory;
@@ -62,19 +57,16 @@ function handleMessage(e) {
62
57
  } else if (e.data.cmd === "run") {
63
58
  Module["__emscripten_thread_init"](
64
59
  e.data.pthread_ptr,
65
- /*isMainBrowserThread=*/ 0,
66
- /*isMainRuntimeThread=*/ 0,
67
- /*canBlock=*/ 1,
60
+ /*is_main=*/ 0,
61
+ /*is_runtime=*/ 0,
62
+ /*can_block=*/ 1,
68
63
  );
64
+ Module["__emscripten_thread_mailbox_await"](e.data.pthread_ptr);
69
65
  Module["establishStackSpace"]();
70
66
  Module["PThread"].receiveObjectTransfer(e.data);
71
67
  Module["PThread"].threadInitTLS();
72
68
  if (!initializedJS) {
73
69
  Module["__embind_initialize_bindings"]();
74
- pendingNotifiedProxyingQueues.forEach((queue) => {
75
- Module["executeNotifiedProxyingQueue"](queue);
76
- });
77
- pendingNotifiedProxyingQueues = [];
78
70
  initializedJS = true;
79
71
  }
80
72
  try {
@@ -89,20 +81,16 @@ function handleMessage(e) {
89
81
  Module["__emscripten_thread_exit"](-1);
90
82
  }
91
83
  } else if (e.data.target === "setimmediate") {
92
- } else if (e.data.cmd === "processProxyingQueue") {
84
+ } else if (e.data.cmd === "checkMailbox") {
93
85
  if (initializedJS) {
94
- Module["executeNotifiedProxyingQueue"](e.data.queue);
95
- } else {
96
- pendingNotifiedProxyingQueues.push(e.data.queue);
86
+ Module["checkMailbox"]();
97
87
  }
98
88
  } else if (e.data.cmd) {
99
- err("worker.js received unknown command " + e.data.cmd);
89
+ err(`worker.js received unknown command ${e.data.cmd}`);
100
90
  err(e.data);
101
91
  }
102
92
  } catch (ex) {
103
- if (Module["__emscripten_thread_crashed"]) {
104
- Module["__emscripten_thread_crashed"]();
105
- }
93
+ Module["__emscripten_thread_crashed"]?.();
106
94
  throw ex;
107
95
  }
108
96
  }