Here is a Sleep function that you can call like this: await(UInt32, Sleep(100))
function Sleep(milliseconds: UInt32): TJSPromise;
begin
Result := TJSPromise.New(
procedure(success, _: TJSPromiseResolver)
begin
window.setTimeout(
procedure
begin
success(milliseconds);
end,
milliseconds
);
end);
end;