virtual-machine 0.0.14 → 0.0.16

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.
@@ -97,6 +97,26 @@ function handleError(f, args) {
97
97
  function isLikeNone(x) {
98
98
  return x === void 0 || x === null;
99
99
  }
100
+ function makeClosure(arg0, arg1, dtor, f) {
101
+ const state = { a: arg0, b: arg1, cnt: 1, dtor };
102
+ const real = (...args) => {
103
+ state.cnt++;
104
+ try {
105
+ return f(state.a, state.b, ...args);
106
+ } finally {
107
+ real._wbg_cb_unref();
108
+ }
109
+ };
110
+ real._wbg_cb_unref = () => {
111
+ if (--state.cnt === 0) {
112
+ state.dtor(state.a, state.b);
113
+ state.a = 0;
114
+ CLOSURE_DTORS.unregister(state);
115
+ }
116
+ };
117
+ CLOSURE_DTORS.register(real, state, state);
118
+ return real;
119
+ }
100
120
  function makeMutClosure(arg0, arg1, dtor, f) {
101
121
  const state = { a: arg0, b: arg1, cnt: 1, dtor };
102
122
  const real = (...args) => {
@@ -186,6 +206,9 @@ if (!("encodeInto" in cachedTextEncoder)) {
186
206
  };
187
207
  }
188
208
  var WASM_VECTOR_LEN = 0;
209
+ function wasm_bindgen__convert__closures_____invoke__h1c84ab4501de45c0(arg0, arg1) {
210
+ wasm.wasm_bindgen__convert__closures_____invoke__h1c84ab4501de45c0(arg0, arg1);
211
+ }
189
212
  function wasm_bindgen__convert__closures_____invoke__h6709295d3f31b919(arg0, arg1, arg2) {
190
213
  wasm.wasm_bindgen__convert__closures_____invoke__h6709295d3f31b919(arg0, arg1, arg2);
191
214
  }
@@ -223,6 +246,7 @@ var WasmVm = class {
223
246
  }
224
247
  /**
225
248
  * Get the current network connection status.
249
+ * This checks the actual connection state by seeing if an IP was assigned.
226
250
  * @returns {NetworkStatus}
227
251
  */
228
252
  network_status() {
@@ -245,6 +269,7 @@ var WasmVm = class {
245
269
  }
246
270
  /**
247
271
  * Connect to a WebTransport relay server.
272
+ * Note: Connection is asynchronous. Check network_status() to monitor connection state.
248
273
  * @param {string} url
249
274
  * @param {string | null} [cert_hash]
250
275
  */
@@ -359,6 +384,12 @@ function __wbg_get_imports() {
359
384
  return ret;
360
385
  }, arguments);
361
386
  };
387
+ imports.wbg.__wbg_call_c8baa5c5e72d274e = function() {
388
+ return handleError(function(arg0, arg1, arg2, arg3) {
389
+ const ret = arg0.call(arg1, arg2, arg3);
390
+ return ret;
391
+ }, arguments);
392
+ };
362
393
  imports.wbg.__wbg_datagrams_05d12f8029dbc662 = function(arg0) {
363
394
  const ret = arg0.datagrams;
364
395
  return ret;
@@ -374,6 +405,9 @@ function __wbg_get_imports() {
374
405
  wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
375
406
  }
376
407
  };
408
+ imports.wbg.__wbg_error_7bc7d576a6aaf855 = function(arg0) {
409
+ console.error(arg0);
410
+ };
377
411
  imports.wbg.__wbg_getReader_b6676f6d8b326942 = function(arg0) {
378
412
  const ret = arg0.getReader();
379
413
  return ret;
@@ -394,6 +428,9 @@ function __wbg_get_imports() {
394
428
  const ret = arg0.length;
395
429
  return ret;
396
430
  };
431
+ imports.wbg.__wbg_log_1d990106d99dacb7 = function(arg0) {
432
+ console.log(arg0);
433
+ };
397
434
  imports.wbg.__wbg_new_1ba21ce319a06297 = function() {
398
435
  const ret = new Object();
399
436
  return ret;
@@ -438,6 +475,10 @@ function __wbg_get_imports() {
438
475
  imports.wbg.__wbg_queueMicrotask_fca69f5bfad613a5 = function(arg0) {
439
476
  queueMicrotask(arg0);
440
477
  };
478
+ imports.wbg.__wbg_random_cc1f9237d866d212 = function() {
479
+ const ret = Math.random();
480
+ return ret;
481
+ };
441
482
  imports.wbg.__wbg_read_39c4b35efcd03c25 = function(arg0) {
442
483
  const ret = arg0.read();
443
484
  return ret;
@@ -502,12 +543,20 @@ function __wbg_get_imports() {
502
543
  const ret = arg0.write(arg1);
503
544
  return ret;
504
545
  };
505
- imports.wbg.__wbindgen_cast_19eead9c9e92d417 = function(arg0, arg1) {
546
+ imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
547
+ const ret = getStringFromWasm0(arg0, arg1);
548
+ return ret;
549
+ };
550
+ imports.wbg.__wbindgen_cast_9d58885f229d7092 = function(arg0, arg1) {
506
551
  const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__hb099e2ae98169675, wasm_bindgen__convert__closures_____invoke__h6709295d3f31b919);
507
552
  return ret;
508
553
  };
509
- imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
510
- const ret = getStringFromWasm0(arg0, arg1);
554
+ imports.wbg.__wbindgen_cast_d6cd19b81560fd6e = function(arg0) {
555
+ const ret = arg0;
556
+ return ret;
557
+ };
558
+ imports.wbg.__wbindgen_cast_dcd0062a54560c23 = function(arg0, arg1) {
559
+ const ret = makeClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h9e6008f022b1daec, wasm_bindgen__convert__closures_____invoke__h1c84ab4501de45c0);
511
560
  return ret;
512
561
  };
513
562
  imports.wbg.__wbindgen_init_externref_table = function() {