* Allow to access webassembly memory as Uint8Array

This commit is contained in:
Michael Van Canneyt 2024-06-05 10:57:24 +02:00
parent b7553d1abf
commit 13742a5375

View File

@ -268,9 +268,15 @@ end;
function TJSObjectBridge.FindGlobalObject(const aName: string): TJOBObjectID;
begin
if not FGlobalNames.hasOwnProperty(aName) then
exit(0);
Result:=NativeInt(FGlobalNames[aName]);
// this one is special, it needs to be re-registered every time
if aName='InstanceMemory' then
Exit(RegisterLocalObject(TJSUint8Array.New(getModuleMemoryDataView.buffer)));
else
begin
if not FGlobalNames.hasOwnProperty(aName) then
exit(0);
Result:=NativeInt(FGlobalNames[aName]);
end;
end;
function TJSObjectBridge.RegisterLocalObject(Obj: TJSObject): TJOBObjectID;