@andreiltd/componentize-qjs-binding-win32-arm64-msvc 0.4.3 → 0.4.4

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 CHANGED
@@ -197,6 +197,7 @@ a project root that contains shared files or `node_modules`.
197
197
  |----------|---------|---------|
198
198
  | `list<T>` | `Array` | `[1, 2, 3]` |
199
199
  | `list<u8>` | `Uint8Array` or `Array` | `new Uint8Array([1, 2, 3])` |
200
+ | `map<K, V>` | `Map` | `new Map([["key", value]])` |
200
201
  | `tuple<T, U, ...>` | `Array` | `[42, "hello"]` |
201
202
  | `option<T>` | `T \| null` (nested: `{ tag: "some"\|"none", val }`) | `null` for none; `option<option<T>>` is wrapped |
202
203
  | `result<T, E>` | top-level function result: return `T` or throw `E`; nested result: `{ tag: "ok"\|"err", val?: T\|E }` | `return 42` / `throw "error"` |
@@ -247,6 +248,36 @@ export async function greet(name) {
247
248
  }
248
249
  ```
249
250
 
251
+ Exported resource methods and static methods may also be async. Implement them
252
+ as `async` members on the exported JavaScript class; resource constructors
253
+ remain synchronous:
254
+
255
+ ```wit
256
+ package example:counter;
257
+
258
+ interface counter-api {
259
+ resource counter {
260
+ constructor(initial: u32);
261
+ add: async func(value: u32) -> u32;
262
+ create: static async func(initial: u32) -> counter;
263
+ }
264
+ }
265
+
266
+ world counter {
267
+ export counter-api;
268
+ }
269
+ ```
270
+
271
+ ```js
272
+ class Counter {
273
+ constructor(initial) { this.value = initial; }
274
+ async add(value) { this.value += value; return this.value; }
275
+ static async create(initial) { return new this(initial); }
276
+ }
277
+
278
+ export const counterApi = { Counter };
279
+ ```
280
+
250
281
  ### Streams
251
282
 
252
283
  Streams transfer a sequence of values between components. Lifted WIT streams
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@andreiltd/componentize-qjs-binding-win32-arm64-msvc",
3
- "version": "0.4.3",
3
+ "version": "0.4.4",
4
4
  "cpu": [
5
5
  "arm64"
6
6
  ],