implement missing finalizeRef implementation from go wasm_exec.js

This commit is contained in:
Arthur Lu 2024-11-01 17:23:04 +00:00
parent 65516fbd50
commit 2c7adbef06

12
wfa.js
View File

@ -300,10 +300,14 @@
// func finalizeRef(v ref) // func finalizeRef(v ref)
"syscall/js.finalizeRef": (v_ref) => { "syscall/js.finalizeRef": (v_ref) => {
// Note: TinyGo does not support finalizers so this should never be const id = mem().getUint32(unboxValue(v_ref), true);
// called. this._goRefCounts[id]--;
//console.error('syscall/js.finalizeRef not implemented'); if (this._goRefCounts[id] === 0) {
// for whatever reason this is called by wfajs but doesnt impact the results at all?? const v = this._values[id];
this._values[id] = null;
this._ids.delete(v);
this._idPool.push(id);
}
}, },
// func stringVal(value string) ref // func stringVal(value string) ref