> new Promise(resolve => doLater(resolve, cts.token)).then(handleResult);
> setImmediate(() => cts.cancel());

> 
> In this scenario cancel would be called right after the resolve method 
> is called, but before handlerResult is called. For this to work with a 
> cancellation token you would need to pass the token to every step in 
> the chain to both stop work being done and to ignore the 
> result/prevent a handler from being called. Wouldn't it be better if 
> the promise chain took care of this for the programmer?

I can be convinced that CancellationToken registrations should be invoked 
asynchronously, though I wonder if then CancellationTokenSource#cancel should 
return a Promise to observe any errors that occur. 

Ron
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to