W3C home > Mailing lists > Public > public-webcrypto@w3.org > April 2013

Re: Updated spec examples with Futures

From: Alex Russell <slightlyoff@google.com>
Date: Sat, 27 Apr 2013 09:54:42 +0100
Message-ID: <CANr5HFUaYppLkSiDZM7bbvHOTXQS3ch2-3uhkdxXc9XDM4Ea0Q@mail.gmail.com>
To: Aymeric Vitte <vitteaymeric@gmail.com>
Cc: "public-webcrypto@w3.org" <public-webcrypto@w3.org>, Ryan Sleevi <rsleevi@chromium.org>
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

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:17:16 UTC