-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft B #5
Comments
should read: If options is of type object its properties, except for name, are copied onto the OperationCanceled error. |
should read: Resolvers may directly cancel themselves if all derived promises are cancelled (directly or indirectly). |
Good points
Bad points
SolutionOne solution to the first point is to require an promise.then(onFulfilled, onRejected, onProgress, onCancelled)
When you wire up one promise, to another (resolver, promise) pair you then need to do something like: promiseA.then(resolverB.fulfill, resolverB.reject. resolverB.progress);
promiseB.then(null, null, null, promiseA.cancel); which is hideous, we need to sort this. |
In short, I don't think removing |
The trick I'm using for propagating cancelation is that with: var aToB = promiseA.then(resolverB.fulfill, resolverB.reject, resolverB.progress); When |
OK, that's fine, since the var aToB = promiseA.then(resolverB.fulfill, resolverB.reject, resolverB.progress);
resolverB.onCancel(aToB.cancel()); Since function then(cb, eb) {
let {promiseB, resolverB} = defer();
resolverB.onCancel(resolverA.cancel); //note here that we **indirectly** cancel ourselves
//Normal then method stuff goes here
return promiseB;
} |
See https://gist.github.com/4407774 for the spec. Work-in-progress implementation at https://github.com/novemberborn/legendary/tree/cancelation-draft-b.
cancel
signaturepropagateCancel
canceled
eventsThe text was updated successfully, but these errors were encountered: