@thi.ng/wasm-api-schedule 1.0.48 → 1.0.49
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/CHANGELOG.md +7 -1
- package/api.d.ts +2 -2
- package/api.js +1 -1
- package/generated/{api.d.ts → types.d.ts} +2 -2
- package/package.json +8 -8
- package/zig/lib.zig +5 -6
- package/zig/{api.zig → types.zig} +2 -1
- /package/generated/{api.js → types.js} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
-
- **Last updated**: 2025-
|
|
3
|
+
- **Last updated**: 2025-09-01T16:38:35Z
|
|
4
4
|
- **Generator**: [thi.ng/monopub](https://thi.ng/monopub)
|
|
5
5
|
|
|
6
6
|
All notable changes to this project will be documented in this file.
|
|
@@ -11,6 +11,12 @@ See [Conventional Commits](https://conventionalcommits.org/) for commit guidelin
|
|
|
11
11
|
**Note:** Unlisted _patch_ versions only involve non-code or otherwise excluded changes
|
|
12
12
|
and/or version bumps of transitive dependencies.
|
|
13
13
|
|
|
14
|
+
### [1.0.49](https://github.com/thi-ng/umbrella/tree/@thi.ng/wasm-api-schedule@1.0.49) (2025-09-01)
|
|
15
|
+
|
|
16
|
+
#### ♻️ Refactoring
|
|
17
|
+
|
|
18
|
+
- internal restructure of generated types ([aaa0207](https://github.com/thi-ng/umbrella/commit/aaa0207))
|
|
19
|
+
|
|
14
20
|
### [1.0.9](https://github.com/thi-ng/umbrella/tree/@thi.ng/wasm-api-schedule@1.0.9) (2024-11-10)
|
|
15
21
|
|
|
16
22
|
#### ♻️ Refactoring
|
package/api.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { WasmExports } from "@thi.ng/wasm-api";
|
|
2
|
-
import type { ScheduleType } from "./generated/
|
|
3
|
-
export * from "./generated/
|
|
2
|
+
import type { ScheduleType } from "./generated/types.js";
|
|
3
|
+
export * from "./generated/types.js";
|
|
4
4
|
export interface WasmScheduleExports extends WasmExports {
|
|
5
5
|
_schedule_init(): void;
|
|
6
6
|
_schedule_callback(timerID: number, type: ScheduleType): void;
|
package/api.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "./generated/
|
|
1
|
+
export * from "./generated/types.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Generated by @thi.ng/wasm-api-bindgen at
|
|
2
|
+
* Generated by @thi.ng/wasm-api-bindgen at 2025-09-01T11:06:15.299Z
|
|
3
3
|
* DO NOT EDIT!
|
|
4
4
|
*/
|
|
5
5
|
export declare enum ScheduleType {
|
|
@@ -20,4 +20,4 @@ export declare enum ScheduleType {
|
|
|
20
20
|
*/
|
|
21
21
|
RAF = 3
|
|
22
22
|
}
|
|
23
|
-
//# sourceMappingURL=
|
|
23
|
+
//# sourceMappingURL=types.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/wasm-api-schedule",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.49",
|
|
4
4
|
"description": "Delayed & scheduled function execution (via setTimeout() etc.) for hybrid WASM apps",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"build": "yarn build:esbuild && yarn build:decl",
|
|
32
32
|
"build:decl": "tsc --declaration --emitDeclarationOnly",
|
|
33
33
|
"build:esbuild": "esbuild --format=esm --platform=neutral --target=es2022 --tsconfig=tsconfig.json --outdir=. src/**/*.ts",
|
|
34
|
-
"build:types": "npx wasm-api-bindgen -a analytics.json --lang ts -o src/generated/
|
|
34
|
+
"build:types": "npx wasm-api-bindgen -a analytics.json --lang ts -o src/generated/types.ts --lang zig -o zig/types.zig src/typedefs.json",
|
|
35
35
|
"clean": "bun ../../tools/src/clean-package.ts",
|
|
36
36
|
"doc": "typedoc --options ../../typedoc.json --out doc src/index.ts",
|
|
37
37
|
"doc:readme": "bun ../../tools/src/module-stats.ts && bun ../../tools/src/readme.ts",
|
|
@@ -40,13 +40,13 @@
|
|
|
40
40
|
"tool:tangle": "../../node_modules/.bin/tangle src/**/*.ts"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@thi.ng/api": "^8.12.
|
|
44
|
-
"@thi.ng/wasm-api": "^2.
|
|
43
|
+
"@thi.ng/api": "^8.12.2",
|
|
44
|
+
"@thi.ng/wasm-api": "^2.4.0"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@thi.ng/wasm-api-bindgen": "^1.2.
|
|
48
|
-
"esbuild": "^0.25.
|
|
49
|
-
"typedoc": "^0.28.
|
|
47
|
+
"@thi.ng/wasm-api-bindgen": "^1.2.39",
|
|
48
|
+
"esbuild": "^0.25.9",
|
|
49
|
+
"typedoc": "^0.28.12",
|
|
50
50
|
"typescript": "^5.9.2"
|
|
51
51
|
},
|
|
52
52
|
"keywords": [
|
|
@@ -95,5 +95,5 @@
|
|
|
95
95
|
"tag": "wasm",
|
|
96
96
|
"year": 2022
|
|
97
97
|
},
|
|
98
|
-
"gitHead": "
|
|
98
|
+
"gitHead": "e215a3e8de3809736ba0042c93bd8703a5a1a337\n"
|
|
99
99
|
}
|
package/zig/lib.zig
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
|
2
2
|
const std = @import("std");
|
|
3
3
|
const wasm = @import("wasm-api");
|
|
4
|
-
const api = @import("api.zig");
|
|
5
4
|
|
|
6
|
-
pub
|
|
5
|
+
pub const types = @import("types.zig");
|
|
7
6
|
|
|
8
7
|
pub const Callback = *const fn (?*anyopaque) void;
|
|
9
8
|
|
|
10
|
-
|
|
9
|
+
const ScheduledCall = struct {
|
|
11
10
|
/// Actual callback function. Takes an optional pointer to user
|
|
12
11
|
/// supplied arbitrary context data provided when registering the handler
|
|
13
12
|
/// via setTimeout() or setInterval()
|
|
@@ -35,17 +34,17 @@ export fn _schedule_init() void {
|
|
|
35
34
|
}
|
|
36
35
|
|
|
37
36
|
/// Internal callback. Called from JS
|
|
38
|
-
export fn _schedule_callback(callID: u16, remove:
|
|
37
|
+
export fn _schedule_callback(callID: u16, remove: types.ScheduleType) void {
|
|
39
38
|
if (calls.get(callID)) |callback| {
|
|
40
39
|
if (remove != .interval) calls.remove(callID);
|
|
41
40
|
callback.callback(callback.ctx);
|
|
42
41
|
}
|
|
43
42
|
}
|
|
44
43
|
|
|
45
|
-
pub extern "schedule" fn _schedule(kind:
|
|
44
|
+
pub extern "schedule" fn _schedule(kind: types.ScheduleType, delay: usize, callID: u16) void;
|
|
46
45
|
|
|
47
46
|
/// Schedules given timer callback of given kind and returns an unique ID handle.
|
|
48
|
-
pub fn schedule(kind:
|
|
47
|
+
pub fn schedule(kind: types.ScheduleType, delay: usize, callback: Callback, ctx: ?*anyopaque) !u16 {
|
|
49
48
|
const callID = try calls.add(.{ .callback = callback, .ctx = ctx });
|
|
50
49
|
_schedule(kind, delay, callID);
|
|
51
50
|
return callID;
|
|
File without changes
|