@puzzlehq/aleo-wasm-web 0.6.0 → 0.6.1

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.
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "The Aleo Team <hello@aleo.org>"
5
5
  ],
6
6
  "description": "WebAssembly based toolkit for developing zero knowledge applications with Aleo",
7
- "version": "0.6.0",
7
+ "version": "0.6.1",
8
8
  "license": "GPL-3.0",
9
9
  "repository": {
10
10
  "type": "git",
@@ -13,7 +13,8 @@
13
13
  "files": [
14
14
  "aleo_wasm_bg.wasm",
15
15
  "aleo_wasm.js",
16
- "aleo_wasm.d.ts"
16
+ "aleo_wasm.d.ts",
17
+ "snippets/"
17
18
  ],
18
19
  "module": "aleo_wasm.js",
19
20
  "homepage": "https://aleo.org",
@@ -28,4 +29,4 @@
28
29
  "decentralized",
29
30
  "zero-knowledge"
30
31
  ]
31
- }
32
+ }
@@ -0,0 +1,27 @@
1
+
2
+ export function spawnWorker(url, module, memory, address) {
3
+ return new Promise((resolve) => {
4
+ const worker = new Worker(url, {
5
+ type: "module",
6
+ });
7
+
8
+ worker.addEventListener("message", (event) => {
9
+ // When running in Node, this allows the process to exit
10
+ // even though the Worker is still running.
11
+ if (worker.unref) {
12
+ worker.unref();
13
+ }
14
+
15
+ resolve(worker);
16
+ }, {
17
+ capture: true,
18
+ once: true,
19
+ });
20
+
21
+ worker.postMessage({
22
+ module,
23
+ memory,
24
+ address,
25
+ });
26
+ });
27
+ }