@ringozz/godot 4.7.2-579 → 4.7.2-583
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/package.json +4 -4
- package/src/runtime.ts +15 -1
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ringozz/godot",
|
|
3
3
|
"author": "Vladimir Davidovich",
|
|
4
|
-
"version": "4.7.2-
|
|
4
|
+
"version": "4.7.2-583",
|
|
5
5
|
"description": "Node-API bindings for Godot Engine — call Godot classes from JavaScript",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
@@ -42,9 +42,9 @@
|
|
|
42
42
|
"precision": "single"
|
|
43
43
|
},
|
|
44
44
|
"optionalDependencies": {
|
|
45
|
-
"@ringozz/godot-macos-arm64": "^4.7.2-
|
|
46
|
-
"@ringozz/godot-windows-x86_64": "^4.7.2-
|
|
47
|
-
"@ringozz/godot-web-wasm32": "^4.7.2-
|
|
45
|
+
"@ringozz/godot-macos-arm64": "^4.7.2-583",
|
|
46
|
+
"@ringozz/godot-windows-x86_64": "^4.7.2-583",
|
|
47
|
+
"@ringozz/godot-web-wasm32": "^4.7.2-583"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
50
|
"@types/bun": "*"
|
package/src/runtime.ts
CHANGED
|
@@ -64,6 +64,15 @@ export const requestAnimationFrame = _mod.requestAnimationFrame as typeof global
|
|
|
64
64
|
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DedicatedWorkerGlobalScope/cancelAnimationFrame) */
|
|
65
65
|
export const cancelAnimationFrame = _mod.cancelAnimationFrame as typeof globalThis.cancelAnimationFrame ?? globalThis.cancelAnimationFrame;
|
|
66
66
|
|
|
67
|
+
// One-shot callbacks of in-flight `_P` awaits. The connection's JSCallable holds
|
|
68
|
+
// only a weak reference to the callback, so without this the function could be
|
|
69
|
+
// GC'd before the signal fires. A module root is the only retention Bun reliably
|
|
70
|
+
// traces: neither `_P`'s closure cells nor a Set attached to the signal's object
|
|
71
|
+
// wrapper survive a full GC while the await is pending (the await machinery
|
|
72
|
+
// discards the promise `_P` returns, and Bun may collect the emitter's wrapper).
|
|
73
|
+
// Removed as soon as the signal fires or the connect fails.
|
|
74
|
+
const pendingCallbacks = new Set<(...args: any[]) => void>();
|
|
75
|
+
|
|
67
76
|
/** Make a Signal PromiseLike: connects a one-shot callback that resolves with the args tuple. */
|
|
68
77
|
export function _P(signal: any, onfulfilled?: any, onrejected?: any) {
|
|
69
78
|
return new Promise<any>((resolve, reject) => {
|
|
@@ -72,11 +81,16 @@ export function _P(signal: any, onfulfilled?: any, onrejected?: any) {
|
|
|
72
81
|
return;
|
|
73
82
|
}
|
|
74
83
|
const cb = (...args: any[]) => {
|
|
84
|
+
pendingCallbacks.delete(cb);
|
|
75
85
|
signal.disconnect(cb);
|
|
76
86
|
resolve(args);
|
|
77
87
|
};
|
|
88
|
+
pendingCallbacks.add(cb);
|
|
78
89
|
const res = signal.connect(cb);
|
|
79
|
-
if (res !== 0)
|
|
90
|
+
if (res !== 0) {
|
|
91
|
+
pendingCallbacks.delete(cb);
|
|
92
|
+
reject(new Error('Failed to connect signal: error code ' + res));
|
|
93
|
+
}
|
|
80
94
|
}).then(onfulfilled, onrejected);
|
|
81
95
|
}
|
|
82
96
|
|