Is it possible to pass a Javascript ref type to assemblyScript solely for the purposes of being retrieved again later? To be clear, I do not want to access the JS object from the WASM side in any way. So no typing should be necessary, I literally want to ‘associate’ a WASM class instance with a corresponding JS instance, such that the JS side can set and retrieve its own ref in the WASM class;
AssemblyScript would look something like;
export function setRef(node: Node, jsRef: i32): void {
node.jsRef = jsRef;
}
export function getRef(node: Node): i32 {
return node.jsRef;
}
I cannot find any info that describes this or a similar scenario. Without this I am having to maintain a mapping on the JS side with all the huge performance implications that implies.
Using i32 my references get passed as zero and if I use externref instead the compiler crashes