[Pas2js] sequencing function calls in pas2js

Michael Van Canneyt michael at freepascal.org
Sat Jun 9 14:28:23 CEST 2018



On Sat, 9 Jun 2018, Mattias Gaertner wrote:

> On Fri, 8 Jun 2018 16:47:23 -0500 (CDT)
> warleyalex via Pas2js <pas2js at lists.freepascal.org> wrote:
>
>> [...]
>> ______________________________
>> OBS: In JS world, we can use Function.prototype.bind to create a new
>> function with a value passed to its first argument, like this
>> 
>> .then(_doTask0.bind(null, '10000'))
>> .then(_doTask1.bind(null, '5000'))
>> .then(_doTask2.bind(null, '2000'))
>> .then(_doTask3.bind(null, '0'));
>> ______________________________
>> 
>> Isn't there some simple way to do this?
>
> Do you want a "bind" or do you want to create a call expression?
>
> About "bind":
> The "bind" needs two language features, that are specific to JS: 
> 1. functions are objects
> 2. no type safety
>
> The first would need pas2js support for typecasting a function to
> TJSFunction.

It would probably be handy to have a function to convert a function address
to a TJSFunction instance.

Michael.


More information about the Pas2js mailing list