Add Canceller for removing progress/then handlers. #31
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
/then
handlers by usingCanceller
.Unlike publish-subscribe-model which normally returns disposable token as returning value,
I decided to use
inout
parameter to maintain Promise pipelining.Usage