Delphi 10.3.3, TMS Web Core 1.6.2.0
I am trying to convert loading of PNG files into a TGraphic from "old" logic (using LoadFromURL with callback procedure) to the new promise/await logic.
My code is now:
var
myBlob: TJSBlob;
response: TJSResponse;
sgBild: TGraphic;
...
sgbild:=TGraphic.Create();
...
response:=await(window.fetch(fn));
if not response.ok then
...
else
begin
myBlob:=await(response.blob());
sgbild.URL:=TJSURL.createobjectURL(myBlob);
ctx.drawImage(sgBild.Image, sgx, sgy);
end;
The old code works, which uses sgbild.LoadFromURL(fn, showgifLoaded); and then in procedure showgifLoaded the call to ctx.drawImage(...) is executed.
No errors are shown in the browser console.
Any hints?