Add Canceller for removing progress/then handlers.#31
Merged
Conversation
c9229d3 to
907008a
Compare
Member
Author
|
|
inamiy
added a commit
that referenced
this pull request
May 10, 2015
Add Canceller for removing progress/then handlers.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
(JavaScript) Promise is normally designed to only attach
then-handlers to preceding task, but it often lacks in those removability, especially when user wants to remove them one-by-one.(Promise usually
removeAll()when it is deallocated)This kind of casual & rough monad structure is not an issue when only dealing with a single future value, but when multiple progressing values come in, without a support of one-by-one invalidation, it will degrade efficiency of multiple task collaboration, i.e. ReactKit.
This pull request will add one-by-one invalidation of
progress/thenhandlers by usingCanceller.Unlike publish-subscribe-model which normally returns disposable token as returning value,
I decided to use
inoutparameter to maintain Promise pipelining.Usage