saito-js 0.1.24 → 0.1.25

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,6 +1,6 @@
1
1
  export default class WasmWrapper<T> {
2
2
  instance: T;
3
+ private static registry;
3
4
  constructor(instance: T);
4
- free(): void;
5
5
  }
6
6
  //# sourceMappingURL=wasm_wrapper.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"wasm_wrapper.d.ts","sourceRoot":"","sources":["../../lib/wasm_wrapper.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,OAAO,OAAO,WAAW,CAAC,CAAC;IACzB,QAAQ,EAAE,CAAC,CAAC;gBAEP,QAAQ,EAAE,CAAC;IAIvB,IAAI;CAIL"}
1
+ {"version":3,"file":"wasm_wrapper.d.ts","sourceRoot":"","sources":["../../lib/wasm_wrapper.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,OAAO,OAAO,WAAW,CAAC,CAAC;IACzB,QAAQ,EAAE,CAAC,CAAC;IAInB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAOpB;gBAES,QAAQ,EAAE,CAAC;CAUxB"}
@@ -1,13 +1,24 @@
1
1
  "use strict";
2
+ // let registry = new FinalizationRegistry((heldValue: any) => {
3
+ // heldValue.free();
4
+ // });
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  class WasmWrapper {
4
7
  constructor(instance) {
5
8
  this.instance = instance;
6
- }
7
- free() {
8
- // @ts-ignore
9
- this.instance.free();
9
+ WasmWrapper.registry.register(this, instance);
10
+ // WasmWrapper.createdCounter++;
10
11
  }
11
12
  }
12
13
  exports.default = WasmWrapper;
14
+ // private static createdCounter = 0;
15
+ // private static deletedCounter = 0;
16
+ WasmWrapper.registry = new FinalizationRegistry((value) => {
17
+ // WasmWrapper.deletedCounter++;
18
+ // console.log(`deleted : ${WasmWrapper.deletedCounter} created : ${WasmWrapper.createdCounter} ptr : ${value.__wbg_ptr}`);
19
+ // @ts-ignore
20
+ if (value && !!value.__wbg_ptr) {
21
+ value.free();
22
+ }
23
+ });
13
24
  //# sourceMappingURL=wasm_wrapper.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"wasm_wrapper.js","sourceRoot":"","sources":["../../lib/wasm_wrapper.ts"],"names":[],"mappings":";;AAAA,MAAqB,WAAW;IAG9B,YAAY,QAAW;QACrB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,CAAC;IAED,IAAI;QACF,aAAa;QACb,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;IACvB,CAAC;CACF;AAXD,8BAWC"}
1
+ {"version":3,"file":"wasm_wrapper.js","sourceRoot":"","sources":["../../lib/wasm_wrapper.ts"],"names":[],"mappings":";AAAA,gEAAgE;AAChE,sBAAsB;AACtB,MAAM;;AAEN,MAAqB,WAAW;IAc9B,YAAY,QAAW;QACrB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,WAAW,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QAC9C,gCAAgC;IAClC,CAAC;;AAlBH,8BAwBC;AArBC,qCAAqC;AACrC,qCAAqC;AACtB,oBAAQ,GAAG,IAAI,oBAAoB,CAAC,CAAC,KAAU,EAAE,EAAE;IAChE,gCAAgC;IAChC,2HAA2H;IAC3H,aAAa;IACb,IAAI,KAAK,IAAI,CAAC,CAAC,KAAK,CAAC,SAAS,EAAE;QAC9B,KAAK,CAAC,IAAI,EAAE,CAAC;KACd;AACH,CAAC,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "saito-js",
3
- "version": "0.1.24",
3
+ "version": "0.1.25",
4
4
  "description": "js wrappings around saito-core using wasm",
5
5
  "scripts": {
6
6
  "test": "env TS_NODE_PROJECT=\"tsconfig.testing.json\" mocha --require ts-node/register 'tests/**/*.ts'",
@@ -36,7 +36,7 @@
36
36
  "morgan": "~1.10.0",
37
37
  "node-fetch": "^2.6.1",
38
38
  "process": "^0.11.10",
39
- "saito-wasm": "^0.1.24",
39
+ "saito-wasm": "^0.1.25",
40
40
  "url": "^0.11.0",
41
41
  "util": "^0.12.5",
42
42
  "ws": "^8.13.0"
package/tsconfig.json CHANGED
@@ -115,5 +115,10 @@
115
115
  //// "es2020.full",
116
116
  //// "es2021.weakref"
117
117
  // ]
118
+ "lib": [
119
+ "es2020",
120
+ "es2021.weakref",
121
+ "dom"
122
+ ]
118
123
  }
119
124
  }