Re: Updated spec examples with Futures

On Thursday, April 25, 2013, Aymeric Vitte wrote:

> Looks nicer than the on_event things.
>
> ".done(console.log.bind(**console, "The signature is:
> "),console.error.bind(console, "Unable to sign"));"
>
> Not sure everybody is familiar with bind(this,args)...
>

One hopes that modern JS is not considered exotic to folks specifying a
large feature that's exposed primarily to JS developers.


> If I want to use Future result, I suppose :
>
> .done(function() {console.log(this.result)})
>


> or (direct result as the last example)
>
> .done(function(result) {console.log(result)})
>

Yep. I'd recommend using the return parameter from the done function
directly. "this.result" won't be portable to other Futures subclasses. So
even more tersely:

    f.done(console.log.bind(console));

= )


> Can I do :
>
> var h=window.crypto.digest("sha1")**;
> var res1=h.process(stream1);
> res1.finish().done(
>     function() {
>         console.log(this.result); //result 1
>     }
> );
> var res2=res1.process(stream2);
> res2.finish().done(
>     function() {
>         console.log(this.result); //result 1+2
>     }
> );
>
> Regards,
>
> Le 25/04/2013 11:51, Alex Russell a écrit :
>
>> As per yesterday's discussion, I've updated the github repo with
>> re-worked examples:
>>
>> https://github.com/**slightlyoff/DOMFuture/commit/**
>> 614dcbb347962092a2b55a85980c9c**c9732175f1<https://github.com/slightlyoff/DOMFuture/commit/614dcbb347962092a2b55a85980c9cc9732175f1>
>>
>> Regards
>>
>
> --
> jCore
> Email :  avitte@jcore.fr
> iAnonym : http://www.ianonym.com
> node-Tor : https://www.github.com/Ayms/**node-Tor<https://www.github.com/Ayms/node-Tor>
> GitHub : https://www.github.com/Ayms
> Web :    www.jcore.fr
> Webble : www.webble.it
> Extract Widget Mobile : www.extractwidget.com
> BlimpMe! : www.blimpme.com
>
>

Received on Saturday, 27 April 2013 08:55:08 UTC