[Pas2js] RES: Pas2js Digest, Vol 39, Issue 1
Wagner Landgraf
wagner at tmssoftware.com
Tue Jun 1 14:01:33 CEST 2021
>> [...]
>> Indeed, I had to create a function that return JSValue even for
>> procedures that are not supposed to return anything:
>>
>> function TXDataWebConnection.OpenAsync: JSValue; async;
>> begin
>> Result := TJSPromise.new(
>> procedure(resolve, reject: TJSPromiseResolver)
>> begin
>> DoConnect(
>> procedure
>> begin
>> if Assigned(FOnConnect) then
>> FOnConnect(Self);
>> resolve(nil);
>> end,
>> procedure(Error: TXDataWebConnectionError)
>> begin
>> reject(EXDataWebConnectionException.Create(Error));
>> end
>> );
>> end
>> );
>> end;
>
> Why does this need an async?
> Why not
>
> function TXDataWebConnection.OpenAsync: TJSPromise;
> begin
> Result := TJSPromise.new..
>
> ?
I don’t remember anymore, does it work fine with await?
Maybe it has to do with some TMS Web Core tooling.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/pas2js/attachments/20210601/c89c64e0/attachment.htm>
More information about the Pas2js
mailing list