Re: Updated spec examples with Futures

On Fri, Apr 26, 2013 at 4:23 PM, Aymeric Vitte <vitteaymeric@gmail.com> wrote:
>
> Le 25/04/2013 17:02, Ryan Sleevi a écrit :
>
>>
>> As mentioned before, no.
>>
>> >
>> > 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
>> >     }
>> > );
>> >
>>
>
> OK, waiting to see the new spec, here the question is not if I can do this
> or not, I can, but this will not produce the correct result
>

No. It will not do what you want.

Once a future is resolved (res1), which is what will happen when the
.finish() is sucessfully called, you will no longer be able to call
.process() on it further.

You don't need to wait for any spec update - this is inherent from
http://dom.spec.whatwg.org/#futures

Received on Friday, 26 April 2013 23:32:33 UTC