@draco-rust/decoder 0.2.0 → 0.3.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/README.md +9 -3
- package/index.d.ts +67 -71
- package/index.js +1 -582
- package/index_bg.wasm +0 -0
- package/index_bg.wasm.d.ts +2 -2
- package/legacy/index.d.ts +67 -71
- package/legacy/index.js +1 -582
- package/legacy/index_bg.wasm +0 -0
- package/legacy/index_bg.wasm.d.ts +2 -2
- package/legacy/pool-core.d.ts +44 -0
- package/legacy/pool-core.js +250 -0
- package/legacy/pool.d.ts +6 -29
- package/legacy/pool.js +15 -184
- package/legacy/tasks.js +2 -0
- package/legacy/worker.js +24 -10
- package/mesh/index.d.ts +67 -71
- package/mesh/index.js +1 -582
- package/mesh/index_bg.wasm +0 -0
- package/mesh/index_bg.wasm.d.ts +2 -2
- package/mesh/pool-core.d.ts +44 -0
- package/mesh/pool-core.js +250 -0
- package/mesh/pool.d.ts +6 -29
- package/mesh/pool.js +15 -184
- package/mesh/tasks.js +2 -0
- package/mesh/worker.js +24 -10
- package/package.json +4 -4
- package/point-cloud/index.d.ts +67 -71
- package/point-cloud/index.js +1 -582
- package/point-cloud/index_bg.wasm +0 -0
- package/point-cloud/index_bg.wasm.d.ts +2 -2
- package/point-cloud/pool-core.d.ts +44 -0
- package/point-cloud/pool-core.js +250 -0
- package/point-cloud/pool.d.ts +6 -29
- package/point-cloud/pool.js +15 -184
- package/point-cloud/tasks.js +2 -0
- package/point-cloud/worker.js +24 -10
- package/pool-core.d.ts +44 -0
- package/pool-core.js +250 -0
- package/pool.d.ts +6 -29
- package/pool.js +15 -184
- package/tasks.js +2 -0
- package/worker.js +24 -10
package/legacy/index.js
CHANGED
|
@@ -1,582 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Decodes a Draco stream and returns its attributes as typed arrays.
|
|
5
|
-
*
|
|
6
|
-
* `attributes` is `undefined` for every attribute in its own component type,
|
|
7
|
-
* or an array of requests `{ name, id, semantic, type }`:
|
|
8
|
-
*
|
|
9
|
-
* - `id`, a unique id, finds that attribute, as glTF's
|
|
10
|
-
* `KHR_draco_mesh_compression` names them; a missing one is an error.
|
|
11
|
-
* - `semantic` (`"POSITION"`, `"NORMAL"`, `"COLOR"`, `"TEX_COORD"` or
|
|
12
|
-
* `"GENERIC"`) finds the first attribute of that type instead, as a `.drc`
|
|
13
|
-
* file is read; a missing one is left out.
|
|
14
|
-
* - `type`, a typed array's name such as `"Float32Array"` or
|
|
15
|
-
* `"Uint16Array"`, converts the values the way upstream's
|
|
16
|
-
* `GetAttributeDataArrayForAllPoints` does; without it the values keep
|
|
17
|
-
* their own type. A value the type cannot hold is an error.
|
|
18
|
-
*
|
|
19
|
-
* The result is `{ success, error, warnings, geometry, index, attributes }`,
|
|
20
|
-
* where `geometry` is `"mesh"` or `"point_cloud"` as the stream's header says,
|
|
21
|
-
* `index` a `Uint32Array` of triangle corners for a mesh and `null` for a
|
|
22
|
-
* point cloud, and each attribute `{ name, uniqueId, semantic, array,
|
|
23
|
-
* itemSize, normalized }`.
|
|
24
|
-
* @param {Uint8Array} data
|
|
25
|
-
* @param {DracoAttributeRequest[] | undefined} attributes
|
|
26
|
-
* @returns {DracoDecodeResult}
|
|
27
|
-
*/
|
|
28
|
-
export function decode_draco(data, attributes) {
|
|
29
|
-
const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_export);
|
|
30
|
-
const len0 = WASM_VECTOR_LEN;
|
|
31
|
-
const ret = wasm.decode_draco(ptr0, len0, addHeapObject(attributes));
|
|
32
|
-
return takeObject(ret);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Install the panic hook, so a panic reads as a message rather than a trap.
|
|
37
|
-
*/
|
|
38
|
-
export function init() {
|
|
39
|
-
wasm.init();
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Decode a standalone Draco payload.
|
|
44
|
-
* @param {Uint8Array} data
|
|
45
|
-
* @returns {any}
|
|
46
|
-
*/
|
|
47
|
-
export function parse_drc_bytes(data) {
|
|
48
|
-
const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_export);
|
|
49
|
-
const len0 = WASM_VECTOR_LEN;
|
|
50
|
-
const ret = wasm.parse_drc_bytes(ptr0, len0);
|
|
51
|
-
return takeObject(ret);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* File extensions this module reads and writes.
|
|
56
|
-
* @returns {string[]}
|
|
57
|
-
*/
|
|
58
|
-
export function supported_extensions() {
|
|
59
|
-
try {
|
|
60
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
61
|
-
wasm.supported_extensions(retptr);
|
|
62
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
63
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
64
|
-
var v1 = getArrayJsValueFromWasm0(r0, r1);
|
|
65
|
-
wasm.__wbindgen_export4(r0, r1 * 4, 4);
|
|
66
|
-
return v1;
|
|
67
|
-
} finally {
|
|
68
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* The version of this WASM module.
|
|
74
|
-
* @returns {string}
|
|
75
|
-
*/
|
|
76
|
-
export function version() {
|
|
77
|
-
let deferred1_0;
|
|
78
|
-
let deferred1_1;
|
|
79
|
-
try {
|
|
80
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
81
|
-
wasm.version(retptr);
|
|
82
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
83
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
84
|
-
deferred1_0 = r0;
|
|
85
|
-
deferred1_1 = r1;
|
|
86
|
-
return getStringFromWasm0(r0, r1);
|
|
87
|
-
} finally {
|
|
88
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
89
|
-
wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
function __wbg_get_imports() {
|
|
93
|
-
const import0 = {
|
|
94
|
-
__proto__: null,
|
|
95
|
-
__wbg___wbindgen_is_null_e343b7d08827ba72: function(arg0) {
|
|
96
|
-
const ret = getObject(arg0) === null;
|
|
97
|
-
return ret;
|
|
98
|
-
},
|
|
99
|
-
__wbg___wbindgen_is_undefined_8865fb403f8fe9d8: function(arg0) {
|
|
100
|
-
const ret = getObject(arg0) === undefined;
|
|
101
|
-
return ret;
|
|
102
|
-
},
|
|
103
|
-
__wbg___wbindgen_number_get_2e0e7dee9f701a71: function(arg0, arg1) {
|
|
104
|
-
const obj = getObject(arg1);
|
|
105
|
-
const ret = typeof(obj) === 'number' ? obj : undefined;
|
|
106
|
-
getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
|
|
107
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
108
|
-
},
|
|
109
|
-
__wbg___wbindgen_string_get_0380ccaa2f57f0d9: function(arg0, arg1) {
|
|
110
|
-
const obj = getObject(arg1);
|
|
111
|
-
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
112
|
-
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
113
|
-
var len1 = WASM_VECTOR_LEN;
|
|
114
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
115
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
116
|
-
},
|
|
117
|
-
__wbg___wbindgen_throw_41e9ee4f547fc59a: function(arg0, arg1) {
|
|
118
|
-
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
119
|
-
},
|
|
120
|
-
__wbg_get_31af05bd4842a84f: function() { return handleError(function (arg0, arg1) {
|
|
121
|
-
const ret = Reflect.get(getObject(arg0), getObject(arg1));
|
|
122
|
-
return addHeapObject(ret);
|
|
123
|
-
}, arguments); },
|
|
124
|
-
__wbg_get_unchecked_288889d017702237: function(arg0, arg1) {
|
|
125
|
-
const ret = getObject(arg0)[arg1 >>> 0];
|
|
126
|
-
return addHeapObject(ret);
|
|
127
|
-
},
|
|
128
|
-
__wbg_isArray_e15a2ff68ffdbef2: function(arg0) {
|
|
129
|
-
const ret = Array.isArray(getObject(arg0));
|
|
130
|
-
return ret;
|
|
131
|
-
},
|
|
132
|
-
__wbg_length_d4bdea10311bd9cf: function(arg0) {
|
|
133
|
-
const ret = getObject(arg0).length;
|
|
134
|
-
return ret;
|
|
135
|
-
},
|
|
136
|
-
__wbg_new_617a8cdb8bb1130e: function() {
|
|
137
|
-
const ret = new Object();
|
|
138
|
-
return addHeapObject(ret);
|
|
139
|
-
},
|
|
140
|
-
__wbg_new_ee2291f50781bf1d: function() {
|
|
141
|
-
const ret = new Array();
|
|
142
|
-
return addHeapObject(ret);
|
|
143
|
-
},
|
|
144
|
-
__wbg_new_from_slice_23f60f47cde8d664: function(arg0, arg1) {
|
|
145
|
-
const ret = new Uint16Array(getArrayU16FromWasm0(arg0, arg1));
|
|
146
|
-
return addHeapObject(ret);
|
|
147
|
-
},
|
|
148
|
-
__wbg_new_from_slice_2443ca2017fac0fd: function(arg0, arg1) {
|
|
149
|
-
const ret = new Int16Array(getArrayI16FromWasm0(arg0, arg1));
|
|
150
|
-
return addHeapObject(ret);
|
|
151
|
-
},
|
|
152
|
-
__wbg_new_from_slice_36f6b4e63daa7f59: function(arg0, arg1) {
|
|
153
|
-
const ret = new Int8Array(getArrayI8FromWasm0(arg0, arg1));
|
|
154
|
-
return addHeapObject(ret);
|
|
155
|
-
},
|
|
156
|
-
__wbg_new_from_slice_37a3c3a194266cb8: function(arg0, arg1) {
|
|
157
|
-
const ret = new Uint32Array(getArrayU32FromWasm0(arg0, arg1));
|
|
158
|
-
return addHeapObject(ret);
|
|
159
|
-
},
|
|
160
|
-
__wbg_new_from_slice_911f717853b222c7: function(arg0, arg1) {
|
|
161
|
-
const ret = new Int32Array(getArrayI32FromWasm0(arg0, arg1));
|
|
162
|
-
return addHeapObject(ret);
|
|
163
|
-
},
|
|
164
|
-
__wbg_new_from_slice_9a868026ffa4208a: function(arg0, arg1) {
|
|
165
|
-
const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
|
|
166
|
-
return addHeapObject(ret);
|
|
167
|
-
},
|
|
168
|
-
__wbg_new_from_slice_aa8f37bd5e72dcc7: function(arg0, arg1) {
|
|
169
|
-
const ret = new BigInt64Array(getArrayI64FromWasm0(arg0, arg1));
|
|
170
|
-
return addHeapObject(ret);
|
|
171
|
-
},
|
|
172
|
-
__wbg_new_from_slice_ca6ad97db1f4779a: function(arg0, arg1) {
|
|
173
|
-
const ret = new Float32Array(getArrayF32FromWasm0(arg0, arg1));
|
|
174
|
-
return addHeapObject(ret);
|
|
175
|
-
},
|
|
176
|
-
__wbg_new_from_slice_f545fd22ddc142b8: function(arg0, arg1) {
|
|
177
|
-
const ret = new Float64Array(getArrayF64FromWasm0(arg0, arg1));
|
|
178
|
-
return addHeapObject(ret);
|
|
179
|
-
},
|
|
180
|
-
__wbg_new_from_slice_f6cd96ab370a57b3: function(arg0, arg1) {
|
|
181
|
-
const ret = new BigUint64Array(getArrayU64FromWasm0(arg0, arg1));
|
|
182
|
-
return addHeapObject(ret);
|
|
183
|
-
},
|
|
184
|
-
__wbg_push_2baf45db356cf468: function(arg0, arg1) {
|
|
185
|
-
const ret = getObject(arg0).push(getObject(arg1));
|
|
186
|
-
return ret;
|
|
187
|
-
},
|
|
188
|
-
__wbg_set_145a351398b48c65: function() { return handleError(function (arg0, arg1, arg2) {
|
|
189
|
-
const ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2));
|
|
190
|
-
return ret;
|
|
191
|
-
}, arguments); },
|
|
192
|
-
__wbindgen_generic_0000000000000001: function(arg0) {
|
|
193
|
-
// Cast intrinsic for `F64 -> Externref`.
|
|
194
|
-
const ret = arg0;
|
|
195
|
-
return addHeapObject(ret);
|
|
196
|
-
},
|
|
197
|
-
__wbindgen_generic_0000000000000002: function(arg0, arg1) {
|
|
198
|
-
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
199
|
-
const ret = getStringFromWasm0(arg0, arg1);
|
|
200
|
-
return addHeapObject(ret);
|
|
201
|
-
},
|
|
202
|
-
__wbindgen_object_drop_ref: function(arg0) {
|
|
203
|
-
takeObject(arg0);
|
|
204
|
-
},
|
|
205
|
-
};
|
|
206
|
-
return {
|
|
207
|
-
__proto__: null,
|
|
208
|
-
"./index_bg.js": import0,
|
|
209
|
-
};
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
function addHeapObject(obj) {
|
|
213
|
-
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
214
|
-
const idx = heap_next;
|
|
215
|
-
heap_next = heap[idx];
|
|
216
|
-
|
|
217
|
-
heap[idx] = obj;
|
|
218
|
-
return idx;
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
function dropObject(idx) {
|
|
222
|
-
if (idx < 1028) return;
|
|
223
|
-
heap[idx] = heap_next;
|
|
224
|
-
heap_next = idx;
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
function getArrayF32FromWasm0(ptr, len) {
|
|
228
|
-
ptr = ptr >>> 0;
|
|
229
|
-
return getFloat32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
function getArrayF64FromWasm0(ptr, len) {
|
|
233
|
-
ptr = ptr >>> 0;
|
|
234
|
-
return getFloat64ArrayMemory0().subarray(ptr / 8, ptr / 8 + len);
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
function getArrayI16FromWasm0(ptr, len) {
|
|
238
|
-
ptr = ptr >>> 0;
|
|
239
|
-
return getInt16ArrayMemory0().subarray(ptr / 2, ptr / 2 + len);
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
function getArrayI32FromWasm0(ptr, len) {
|
|
243
|
-
ptr = ptr >>> 0;
|
|
244
|
-
return getInt32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
function getArrayI64FromWasm0(ptr, len) {
|
|
248
|
-
ptr = ptr >>> 0;
|
|
249
|
-
return getBigInt64ArrayMemory0().subarray(ptr / 8, ptr / 8 + len);
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
function getArrayI8FromWasm0(ptr, len) {
|
|
253
|
-
ptr = ptr >>> 0;
|
|
254
|
-
return getInt8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
function getArrayJsValueFromWasm0(ptr, len) {
|
|
258
|
-
ptr = ptr >>> 0;
|
|
259
|
-
const mem = getDataViewMemory0();
|
|
260
|
-
const result = [];
|
|
261
|
-
for (let i = ptr; i < ptr + 4 * len; i += 4) {
|
|
262
|
-
result.push(takeObject(mem.getUint32(i, true)));
|
|
263
|
-
}
|
|
264
|
-
return result;
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
function getArrayU16FromWasm0(ptr, len) {
|
|
268
|
-
ptr = ptr >>> 0;
|
|
269
|
-
return getUint16ArrayMemory0().subarray(ptr / 2, ptr / 2 + len);
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
function getArrayU32FromWasm0(ptr, len) {
|
|
273
|
-
ptr = ptr >>> 0;
|
|
274
|
-
return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
function getArrayU64FromWasm0(ptr, len) {
|
|
278
|
-
ptr = ptr >>> 0;
|
|
279
|
-
return getBigUint64ArrayMemory0().subarray(ptr / 8, ptr / 8 + len);
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
function getArrayU8FromWasm0(ptr, len) {
|
|
283
|
-
ptr = ptr >>> 0;
|
|
284
|
-
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
let cachedBigInt64ArrayMemory0 = null;
|
|
288
|
-
function getBigInt64ArrayMemory0() {
|
|
289
|
-
if (cachedBigInt64ArrayMemory0 === null || cachedBigInt64ArrayMemory0.byteLength === 0) {
|
|
290
|
-
cachedBigInt64ArrayMemory0 = new BigInt64Array(wasm.memory.buffer);
|
|
291
|
-
}
|
|
292
|
-
return cachedBigInt64ArrayMemory0;
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
let cachedBigUint64ArrayMemory0 = null;
|
|
296
|
-
function getBigUint64ArrayMemory0() {
|
|
297
|
-
if (cachedBigUint64ArrayMemory0 === null || cachedBigUint64ArrayMemory0.byteLength === 0) {
|
|
298
|
-
cachedBigUint64ArrayMemory0 = new BigUint64Array(wasm.memory.buffer);
|
|
299
|
-
}
|
|
300
|
-
return cachedBigUint64ArrayMemory0;
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
let cachedDataViewMemory0 = null;
|
|
304
|
-
function getDataViewMemory0() {
|
|
305
|
-
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
306
|
-
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
307
|
-
}
|
|
308
|
-
return cachedDataViewMemory0;
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
let cachedFloat32ArrayMemory0 = null;
|
|
312
|
-
function getFloat32ArrayMemory0() {
|
|
313
|
-
if (cachedFloat32ArrayMemory0 === null || cachedFloat32ArrayMemory0.byteLength === 0) {
|
|
314
|
-
cachedFloat32ArrayMemory0 = new Float32Array(wasm.memory.buffer);
|
|
315
|
-
}
|
|
316
|
-
return cachedFloat32ArrayMemory0;
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
let cachedFloat64ArrayMemory0 = null;
|
|
320
|
-
function getFloat64ArrayMemory0() {
|
|
321
|
-
if (cachedFloat64ArrayMemory0 === null || cachedFloat64ArrayMemory0.byteLength === 0) {
|
|
322
|
-
cachedFloat64ArrayMemory0 = new Float64Array(wasm.memory.buffer);
|
|
323
|
-
}
|
|
324
|
-
return cachedFloat64ArrayMemory0;
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
let cachedInt16ArrayMemory0 = null;
|
|
328
|
-
function getInt16ArrayMemory0() {
|
|
329
|
-
if (cachedInt16ArrayMemory0 === null || cachedInt16ArrayMemory0.byteLength === 0) {
|
|
330
|
-
cachedInt16ArrayMemory0 = new Int16Array(wasm.memory.buffer);
|
|
331
|
-
}
|
|
332
|
-
return cachedInt16ArrayMemory0;
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
let cachedInt32ArrayMemory0 = null;
|
|
336
|
-
function getInt32ArrayMemory0() {
|
|
337
|
-
if (cachedInt32ArrayMemory0 === null || cachedInt32ArrayMemory0.byteLength === 0) {
|
|
338
|
-
cachedInt32ArrayMemory0 = new Int32Array(wasm.memory.buffer);
|
|
339
|
-
}
|
|
340
|
-
return cachedInt32ArrayMemory0;
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
let cachedInt8ArrayMemory0 = null;
|
|
344
|
-
function getInt8ArrayMemory0() {
|
|
345
|
-
if (cachedInt8ArrayMemory0 === null || cachedInt8ArrayMemory0.byteLength === 0) {
|
|
346
|
-
cachedInt8ArrayMemory0 = new Int8Array(wasm.memory.buffer);
|
|
347
|
-
}
|
|
348
|
-
return cachedInt8ArrayMemory0;
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
function getStringFromWasm0(ptr, len) {
|
|
352
|
-
return decodeText(ptr >>> 0, len);
|
|
353
|
-
}
|
|
354
|
-
|
|
355
|
-
let cachedUint16ArrayMemory0 = null;
|
|
356
|
-
function getUint16ArrayMemory0() {
|
|
357
|
-
if (cachedUint16ArrayMemory0 === null || cachedUint16ArrayMemory0.byteLength === 0) {
|
|
358
|
-
cachedUint16ArrayMemory0 = new Uint16Array(wasm.memory.buffer);
|
|
359
|
-
}
|
|
360
|
-
return cachedUint16ArrayMemory0;
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
let cachedUint32ArrayMemory0 = null;
|
|
364
|
-
function getUint32ArrayMemory0() {
|
|
365
|
-
if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
|
|
366
|
-
cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
|
|
367
|
-
}
|
|
368
|
-
return cachedUint32ArrayMemory0;
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
let cachedUint8ArrayMemory0 = null;
|
|
372
|
-
function getUint8ArrayMemory0() {
|
|
373
|
-
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
374
|
-
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
375
|
-
}
|
|
376
|
-
return cachedUint8ArrayMemory0;
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
function getObject(idx) { return heap[idx]; }
|
|
380
|
-
|
|
381
|
-
function handleError(f, args) {
|
|
382
|
-
try {
|
|
383
|
-
return f.apply(this, args);
|
|
384
|
-
} catch (e) {
|
|
385
|
-
wasm.__wbindgen_export3(addHeapObject(e));
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
let heap = new Array(1024).fill(undefined);
|
|
390
|
-
heap.push(undefined, null, true, false);
|
|
391
|
-
|
|
392
|
-
let heap_next = heap.length;
|
|
393
|
-
|
|
394
|
-
function isLikeNone(x) {
|
|
395
|
-
return x === undefined || x === null;
|
|
396
|
-
}
|
|
397
|
-
|
|
398
|
-
function passArray8ToWasm0(arg, malloc) {
|
|
399
|
-
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
400
|
-
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
401
|
-
WASM_VECTOR_LEN = arg.length;
|
|
402
|
-
return ptr;
|
|
403
|
-
}
|
|
404
|
-
|
|
405
|
-
function passStringToWasm0(arg, malloc, realloc) {
|
|
406
|
-
if (realloc === undefined) {
|
|
407
|
-
const buf = cachedTextEncoder.encode(arg);
|
|
408
|
-
const ptr = malloc(buf.length, 1) >>> 0;
|
|
409
|
-
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
410
|
-
WASM_VECTOR_LEN = buf.length;
|
|
411
|
-
return ptr;
|
|
412
|
-
}
|
|
413
|
-
|
|
414
|
-
let len = arg.length;
|
|
415
|
-
let ptr = malloc(len, 1) >>> 0;
|
|
416
|
-
|
|
417
|
-
const mem = getUint8ArrayMemory0();
|
|
418
|
-
|
|
419
|
-
let offset = 0;
|
|
420
|
-
|
|
421
|
-
for (; offset < len; offset++) {
|
|
422
|
-
const code = arg.charCodeAt(offset);
|
|
423
|
-
if (code > 0x7F) break;
|
|
424
|
-
mem[ptr + offset] = code;
|
|
425
|
-
}
|
|
426
|
-
if (offset !== len) {
|
|
427
|
-
if (offset !== 0) {
|
|
428
|
-
arg = arg.slice(offset);
|
|
429
|
-
}
|
|
430
|
-
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
431
|
-
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
432
|
-
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
433
|
-
|
|
434
|
-
offset += ret.written;
|
|
435
|
-
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
436
|
-
}
|
|
437
|
-
|
|
438
|
-
WASM_VECTOR_LEN = offset;
|
|
439
|
-
return ptr;
|
|
440
|
-
}
|
|
441
|
-
|
|
442
|
-
function takeObject(idx) {
|
|
443
|
-
const ret = getObject(idx);
|
|
444
|
-
dropObject(idx);
|
|
445
|
-
return ret;
|
|
446
|
-
}
|
|
447
|
-
|
|
448
|
-
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
449
|
-
cachedTextDecoder.decode();
|
|
450
|
-
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
451
|
-
let numBytesDecoded = 0;
|
|
452
|
-
function decodeText(ptr, len) {
|
|
453
|
-
numBytesDecoded += len;
|
|
454
|
-
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
455
|
-
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
456
|
-
cachedTextDecoder.decode();
|
|
457
|
-
numBytesDecoded = len;
|
|
458
|
-
}
|
|
459
|
-
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
460
|
-
}
|
|
461
|
-
|
|
462
|
-
const cachedTextEncoder = new TextEncoder();
|
|
463
|
-
|
|
464
|
-
if (!('encodeInto' in cachedTextEncoder)) {
|
|
465
|
-
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
466
|
-
const buf = cachedTextEncoder.encode(arg);
|
|
467
|
-
view.set(buf);
|
|
468
|
-
return {
|
|
469
|
-
read: arg.length,
|
|
470
|
-
written: buf.length
|
|
471
|
-
};
|
|
472
|
-
};
|
|
473
|
-
}
|
|
474
|
-
|
|
475
|
-
let WASM_VECTOR_LEN = 0;
|
|
476
|
-
|
|
477
|
-
let wasmModule, wasmInstance, wasm;
|
|
478
|
-
function __wbg_finalize_init(instance, module) {
|
|
479
|
-
wasmInstance = instance;
|
|
480
|
-
wasm = instance.exports;
|
|
481
|
-
wasmModule = module;
|
|
482
|
-
cachedBigInt64ArrayMemory0 = null;
|
|
483
|
-
cachedBigUint64ArrayMemory0 = null;
|
|
484
|
-
cachedDataViewMemory0 = null;
|
|
485
|
-
cachedFloat32ArrayMemory0 = null;
|
|
486
|
-
cachedFloat64ArrayMemory0 = null;
|
|
487
|
-
cachedInt16ArrayMemory0 = null;
|
|
488
|
-
cachedInt32ArrayMemory0 = null;
|
|
489
|
-
cachedInt8ArrayMemory0 = null;
|
|
490
|
-
cachedUint16ArrayMemory0 = null;
|
|
491
|
-
cachedUint32ArrayMemory0 = null;
|
|
492
|
-
cachedUint8ArrayMemory0 = null;
|
|
493
|
-
wasm.__wbindgen_start();
|
|
494
|
-
return wasm;
|
|
495
|
-
}
|
|
496
|
-
|
|
497
|
-
async function __wbg_load(module, imports) {
|
|
498
|
-
if (typeof Response === 'function' && module instanceof Response) {
|
|
499
|
-
if (!module.ok) {
|
|
500
|
-
throw new Error(`failed to fetch Wasm: ${module.status} ${module.statusText} fetching '${module.url}'`);
|
|
501
|
-
}
|
|
502
|
-
|
|
503
|
-
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
|
504
|
-
try {
|
|
505
|
-
return await WebAssembly.instantiateStreaming(module, imports);
|
|
506
|
-
} catch (e) {
|
|
507
|
-
const validResponse = expectedResponseType(module.type);
|
|
508
|
-
|
|
509
|
-
if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
|
|
510
|
-
console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
|
|
511
|
-
|
|
512
|
-
} else { throw e; }
|
|
513
|
-
}
|
|
514
|
-
}
|
|
515
|
-
|
|
516
|
-
const bytes = await module.arrayBuffer();
|
|
517
|
-
return await WebAssembly.instantiate(bytes, imports);
|
|
518
|
-
} else {
|
|
519
|
-
const instance = await WebAssembly.instantiate(module, imports);
|
|
520
|
-
|
|
521
|
-
if (instance instanceof WebAssembly.Instance) {
|
|
522
|
-
return { instance, module };
|
|
523
|
-
} else {
|
|
524
|
-
return instance;
|
|
525
|
-
}
|
|
526
|
-
}
|
|
527
|
-
|
|
528
|
-
function expectedResponseType(type) {
|
|
529
|
-
switch (type) {
|
|
530
|
-
case 'basic': case 'cors': case 'default': return true;
|
|
531
|
-
}
|
|
532
|
-
return false;
|
|
533
|
-
}
|
|
534
|
-
}
|
|
535
|
-
|
|
536
|
-
function initSync(module) {
|
|
537
|
-
if (wasm !== undefined) return wasm;
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
if (module !== undefined) {
|
|
541
|
-
if (Object.getPrototypeOf(module) === Object.prototype) {
|
|
542
|
-
({module} = module)
|
|
543
|
-
} else {
|
|
544
|
-
console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
|
|
545
|
-
}
|
|
546
|
-
}
|
|
547
|
-
|
|
548
|
-
const imports = __wbg_get_imports();
|
|
549
|
-
if (!(module instanceof WebAssembly.Module)) {
|
|
550
|
-
module = new WebAssembly.Module(module);
|
|
551
|
-
}
|
|
552
|
-
const instance = new WebAssembly.Instance(module, imports);
|
|
553
|
-
return __wbg_finalize_init(instance, module);
|
|
554
|
-
}
|
|
555
|
-
|
|
556
|
-
async function __wbg_init(module_or_path) {
|
|
557
|
-
if (wasm !== undefined) return wasm;
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
if (module_or_path !== undefined) {
|
|
561
|
-
if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
|
|
562
|
-
({module_or_path} = module_or_path)
|
|
563
|
-
} else {
|
|
564
|
-
console.warn('using deprecated parameters for the initialization function; pass a single object instead')
|
|
565
|
-
}
|
|
566
|
-
}
|
|
567
|
-
|
|
568
|
-
if (module_or_path === undefined) {
|
|
569
|
-
module_or_path = new URL('index_bg.wasm', import.meta.url);
|
|
570
|
-
}
|
|
571
|
-
const imports = __wbg_get_imports();
|
|
572
|
-
|
|
573
|
-
if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
|
|
574
|
-
module_or_path = fetch(module_or_path);
|
|
575
|
-
}
|
|
576
|
-
|
|
577
|
-
const { instance, module } = await __wbg_load(await module_or_path, imports);
|
|
578
|
-
|
|
579
|
-
return __wbg_finalize_init(instance, module);
|
|
580
|
-
}
|
|
581
|
-
|
|
582
|
-
export { initSync, __wbg_init as default };
|
|
1
|
+
let o;function c(e){x===_.length&&_.push(_.length+1);const n=x;return x=_[n],_[n]=e,n}function C(e){e<132||(_[e]=x,x=e)}function P(e,n){return e=e>>>0,$().subarray(e/4,e/4+n)}function V(e,n){return e=e>>>0,ee().subarray(e/8,e/8+n)}function N(e,n){return e=e>>>0,ne().subarray(e/2,e/2+n)}function q(e,n){return e=e>>>0,te().subarray(e/4,e/4+n)}function z(e,n){return e=e>>>0,Q().subarray(e/8,e/8+n)}function X(e,n){return e=e>>>0,re().subarray(e/1,e/1+n)}function Y(e,n){e=e>>>0;const t=f(),r=[];for(let i=e;i<e+4*n;i+=4)r.push(L(t.getUint32(i,!0)));return r}function H(e,n){return e=e>>>0,oe().subarray(e/2,e/2+n)}function J(e,n){return e=e>>>0,ie().subarray(e/4,e/4+n)}function G(e,n){return e=e>>>0,Z().subarray(e/8,e/8+n)}function K(e,n){return e=e>>>0,y().subarray(e/1,e/1+n)}let d=null;function Q(){return(d===null||d.byteLength===0)&&(d=new BigInt64Array(o.memory.buffer)),d}let m=null;function Z(){return(m===null||m.byteLength===0)&&(m=new BigUint64Array(o.memory.buffer)),m}let b=null;function f(){return(b===null||b.buffer.detached===!0||b.buffer.detached===void 0&&b.buffer!==o.memory.buffer)&&(b=new DataView(o.memory.buffer)),b}let A=null;function $(){return(A===null||A.byteLength===0)&&(A=new Float32Array(o.memory.buffer)),A}let h=null;function ee(){return(h===null||h.byteLength===0)&&(h=new Float64Array(o.memory.buffer)),h}let p=null;function ne(){return(p===null||p.byteLength===0)&&(p=new Int16Array(o.memory.buffer)),p}let I=null;function te(){return(I===null||I.byteLength===0)&&(I=new Int32Array(o.memory.buffer)),I}let M=null;function re(){return(M===null||M.byteLength===0)&&(M=new Int8Array(o.memory.buffer)),M}function v(e,n){return e=e>>>0,ue(e,n)}let F=null;function oe(){return(F===null||F.byteLength===0)&&(F=new Uint16Array(o.memory.buffer)),F}let W=null;function ie(){return(W===null||W.byteLength===0)&&(W=new Uint32Array(o.memory.buffer)),W}let U=null;function y(){return(U===null||U.byteLength===0)&&(U=new Uint8Array(o.memory.buffer)),U}function a(e){return _[e]}function S(e,n){try{return e.apply(this,n)}catch(t){o.__wbindgen_export3(c(t))}}let _=new Array(128).fill(void 0);_.push(void 0,null,!0,!1);let x=_.length;function E(e){return e==null}function B(e,n){const t=n(e.length*1,1)>>>0;return y().set(e,t/1),l=e.length,t}function ce(e,n,t){if(t===void 0){const s=O.encode(e),w=n(s.length,1)>>>0;return y().subarray(w,w+s.length).set(s),l=s.length,w}let r=e.length,i=n(r,1)>>>0;const g=y();let u=0;for(;u<r;u++){const s=e.charCodeAt(u);if(s>127)break;g[i+u]=s}if(u!==r){u!==0&&(e=e.slice(u)),i=t(i,r,r=u+e.length*3,1)>>>0;const s=y().subarray(i+u,i+r),w=O.encodeInto(e,s);u+=w.written,i=t(i,r,u,1)>>>0}return l=u,i}function L(e){const n=a(e);return C(e),n}let j=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});j.decode();const ae=2146435072;let R=0;function ue(e,n){return R+=n,R>=ae&&(j=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}),j.decode(),R=n),j.decode(y().subarray(e,e+n))}const O=new TextEncoder;"encodeInto"in O||(O.encodeInto=function(e,n){const t=O.encode(e);return n.set(t),{read:e.length,written:t.length}});let l=0;function be(e,n,t){const r=B(e,o.__wbindgen_export),i=l,g=o.decode_draco(r,i,c(n),E(t)?0:c(t));return L(g)}function ye(){o.init()}function le(e){const n=B(e,o.__wbindgen_export),t=l,r=o.parse_drc_bytes(n,t);return L(r)}function ge(){try{const r=o.__wbindgen_add_to_stack_pointer(-16);o.supported_extensions(r);var e=f().getInt32(r+0,!0),n=f().getInt32(r+4,!0),t=Y(e,n).slice();return o.__wbindgen_export4(e,n*4,4),t}finally{o.__wbindgen_add_to_stack_pointer(16)}}function we(){let e,n;try{const i=o.__wbindgen_add_to_stack_pointer(-16);o.version(i);var t=f().getInt32(i+0,!0),r=f().getInt32(i+4,!0);return e=t,n=r,v(t,r)}finally{o.__wbindgen_add_to_stack_pointer(16),o.__wbindgen_export4(e,n,1)}}const se=new Set(["basic","cors","default"]);async function fe(e,n){if(typeof Response=="function"&&e instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(e,n)}catch(r){if(e.ok&&se.has(e.type)&&e.headers.get("Content-Type")!=="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",r);else throw r}const t=await e.arrayBuffer();return await WebAssembly.instantiate(t,n)}else{const t=await WebAssembly.instantiate(e,n);return t instanceof WebAssembly.Instance?{instance:t,module:e}:t}}function T(){const e={};return e.wbg={},e.wbg.__wbg___wbindgen_is_null_dfda7d66506c95b5=function(n){return a(n)===null},e.wbg.__wbg___wbindgen_is_undefined_f6b95eab589e0269=function(n){return a(n)===void 0},e.wbg.__wbg___wbindgen_number_get_9619185a74197f95=function(n,t){const r=a(t),i=typeof r=="number"?r:void 0;f().setFloat64(n+8,E(i)?0:i,!0),f().setInt32(n+0,!E(i),!0)},e.wbg.__wbg___wbindgen_string_get_a2a31e16edf96e42=function(n,t){const r=a(t),i=typeof r=="string"?r:void 0;var g=E(i)?0:ce(i,o.__wbindgen_export,o.__wbindgen_export2),u=l;f().setInt32(n+4,u,!0),f().setInt32(n+0,g,!0)},e.wbg.__wbg___wbindgen_throw_dd24417ed36fc46e=function(n,t){throw new Error(v(n,t))},e.wbg.__wbg_get_6b7bd52aca3f9671=function(n,t){const r=a(n)[t>>>0];return c(r)},e.wbg.__wbg_get_af9dab7e9603ea93=function(){return S(function(n,t){const r=Reflect.get(a(n),a(t));return c(r)},arguments)},e.wbg.__wbg_isArray_51fd9e6422c0a395=function(n){return Array.isArray(a(n))},e.wbg.__wbg_length_d45040a40c570362=function(n){return a(n).length},e.wbg.__wbg_new_1ba21ce319a06297=function(){const n=new Object;return c(n)},e.wbg.__wbg_new_25f239778d6112b9=function(){const n=new Array;return c(n)},e.wbg.__wbg_new_from_slice_098150f7f9c5954f=function(n,t){const r=new Int8Array(X(n,t));return c(r)},e.wbg.__wbg_new_from_slice_38fc2f73c393de5c=function(n,t){const r=new BigInt64Array(z(n,t));return c(r)},e.wbg.__wbg_new_from_slice_41e2764a343e3cb1=function(n,t){const r=new Float32Array(P(n,t));return c(r)},e.wbg.__wbg_new_from_slice_4d703bec0a9a4603=function(n,t){const r=new Int16Array(N(n,t));return c(r)},e.wbg.__wbg_new_from_slice_883d10a76ca46292=function(n,t){const r=new BigUint64Array(G(n,t));return c(r)},e.wbg.__wbg_new_from_slice_9a48ef80d2a51f94=function(n,t){const r=new Float64Array(V(n,t));return c(r)},e.wbg.__wbg_new_from_slice_db0691b69e9d3891=function(n,t){const r=new Uint32Array(J(n,t));return c(r)},e.wbg.__wbg_new_from_slice_e6bd3cfb5a35313d=function(n,t){const r=new Int32Array(q(n,t));return c(r)},e.wbg.__wbg_new_from_slice_f9c22b9153b26992=function(n,t){const r=new Uint8Array(K(n,t));return c(r)},e.wbg.__wbg_new_from_slice_fc4260e3a67db282=function(n,t){const r=new Uint16Array(H(n,t));return c(r)},e.wbg.__wbg_push_7d9be8f38fc13975=function(n,t){return a(n).push(a(t))},e.wbg.__wbg_set_781438a03c0c3c81=function(){return S(function(n,t,r){return Reflect.set(a(n),a(t),a(r))},arguments)},e.wbg.__wbindgen_cast_2241b6af4c4b2941=function(n,t){const r=v(n,t);return c(r)},e.wbg.__wbindgen_cast_d6cd19b81560fd6e=function(n){return c(n)},e.wbg.__wbindgen_object_drop_ref=function(n){L(n)},e}function D(e,n){return o=e.exports,k.__wbindgen_wasm_module=n,d=null,m=null,b=null,A=null,h=null,p=null,I=null,M=null,F=null,W=null,U=null,o.__wbindgen_start(),o}function _e(e){if(o!==void 0)return o;typeof e<"u"&&(Object.getPrototypeOf(e)===Object.prototype?{module:e}=e:console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));const n=T();e instanceof WebAssembly.Module||(e=new WebAssembly.Module(e));const t=new WebAssembly.Instance(e,n);return D(t,e)}async function k(e){if(o!==void 0)return o;typeof e<"u"&&(Object.getPrototypeOf(e)===Object.prototype?{module_or_path:e}=e:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),typeof e>"u"&&(e=new URL("index_bg.wasm",import.meta.url));const n=T();(typeof e=="string"||typeof Request=="function"&&e instanceof Request||typeof URL=="function"&&e instanceof URL)&&(e=fetch(e));const{instance:t,module:r}=await fe(await e,n);return D(t,r)}var de=k;export{be as decode_draco,de as default,ye as init,_e as initSync,le as parse_drc_bytes,ge as supported_extensions,we as version};
|
package/legacy/index_bg.wasm
CHANGED
|
Binary file
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
|
-
export const decode_draco: (a: number, b: number, c: number) => number;
|
|
5
|
-
export const init: () => void;
|
|
4
|
+
export const decode_draco: (a: number, b: number, c: number, d: number) => number;
|
|
6
5
|
export const parse_drc_bytes: (a: number, b: number) => number;
|
|
7
6
|
export const supported_extensions: (a: number) => void;
|
|
8
7
|
export const version: (a: number) => void;
|
|
8
|
+
export const init: () => void;
|
|
9
9
|
export const __wbindgen_export: (a: number, b: number) => number;
|
|
10
10
|
export const __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
|
|
11
11
|
export const __wbindgen_export3: (a: number) => void;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export interface PoolOptions {
|
|
2
|
+
/**
|
|
3
|
+
* How many workers to run at most; they start as work arrives. Defaults to
|
|
4
|
+
* one less than the cores, between one and four. `0` runs on the calling
|
|
5
|
+
* thread, as does an environment without workers.
|
|
6
|
+
*/
|
|
7
|
+
workers?: number;
|
|
8
|
+
/**
|
|
9
|
+
* The entry's wasm, when it is not next to this module where the pool looks
|
|
10
|
+
* for it: a URL, a `Response`, the bytes, or a compiled module.
|
|
11
|
+
*/
|
|
12
|
+
wasm?: string | URL | Response | BufferSource | WebAssembly.Module;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface TaskOptions {
|
|
16
|
+
/**
|
|
17
|
+
* Hand the input's buffers to the worker instead of copying them, leaving
|
|
18
|
+
* them detached here. For buffers nothing else reads afterwards.
|
|
19
|
+
*/
|
|
20
|
+
transfer?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Abandons the task: the promise rejects with the signal's reason at once.
|
|
23
|
+
* A task a worker has already started still runs to its end, and its result
|
|
24
|
+
* is dropped; one not yet sent is never sent.
|
|
25
|
+
*/
|
|
26
|
+
signal?: AbortSignal;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface Pool {
|
|
30
|
+
/** Compiles the wasm and starts one worker ahead of the first task. */
|
|
31
|
+
preload(): Promise<void>;
|
|
32
|
+
/** Changes the worker limit; idle workers past it stop now, busy ones when done. */
|
|
33
|
+
setWorkerLimit(workers: number): void;
|
|
34
|
+
readonly workerLimit: number;
|
|
35
|
+
/** Stops every worker and rejects what they held. */
|
|
36
|
+
dispose(): void;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export interface TaskPool extends Pool {
|
|
40
|
+
/** Runs the task `tasks.js` exports under `name` on a worker. */
|
|
41
|
+
run(name: string, args?: unknown[], options?: TaskOptions): Promise<any>;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export function createPool(options?: PoolOptions): TaskPool;
|