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