Skip to content
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

WIP: Cancellation #21

Open
wants to merge 28 commits into
base: master
Choose a base branch
from
Open

WIP: Cancellation #21

wants to merge 28 commits into from

Conversation

bergus
Copy link
Contributor

@bergus bergus commented Jul 11, 2016

Closes #8
Tests fail because of another Buble bug
Please discuss only stylistic issues with the code here, for everything about understanding cancellation and API design choices (method names, behaviour, etc) please open an issue in my repository.

Documentation has now highest priority on my todo list :-)

bergus added 25 commits July 11, 2016 20:23
* fix quotes of argument to uglify
* not sure whether specifying the path node_modules/mocha/bin/ is an
  antipattern (some comments by npm authors claim so) but istanbul does
  not seem to take the PATH into account
just switch "main" of package.json to "dist/creed.node.js"
benchmarks will automatically use it
* No more dependency injection of `fulfill`/`resolve` functions
* moved around code a bit, especially utils, iteration stuff, combinator functions
* simplified some exports that now export a function, not a function factory
* Some circular dependencies, mostly completely declarative
  - Promise - ErrorHandler, inspect: silenceError
  - Promise - combinators: Future, never, silenceError / race
* tests always import `main` unless they test internals
no subscription yet
* implemented token only for Fulfilled, Rejected and Never yet
* "need it" is subjective. I've included all obviously cancellable
  actions, and excluded pure combinators. `merge` should have a token,
  but it's difficult given its signature
* for some reason jsinspect detects a large similarity between Fulfilled
  and Rejected now, but letting it check for identifiers fixes that (?)
(with full coverage of CancelToken.js)
Also fixing some linting issues, typos and bugs in the cancellation code :-)
* then, catch, map, ap, chain (including edge scenarios)
* new Promise
* delay

(with full coverage of everything!)

Also fixing some coverage excludes and bugs in the cancellation code :-)
complete with small test suite and full coverage
required some work especially for coroutines
* factored SwappableCancelToken out of coroutine.js
* made .requested work as expected on LiveCancelTokens
* added tests for all of those
* fixed return values of .cancel()
* refactored common elements of CancelTokenPool and CancelTokenReference
  into CancelTokenCombinator
* added CancelToken.race() with CancelTokenRace
* tested them
* Now behaving more like .getRejected().catch(...)
* taking a token instead of a promise
* ...OrCall being the super-easy way to cancel a subscription
* rewrite Action::cancel, Action::tryCall
* fix some tests
* add tests for finally
* with lots of tests
* also add tests and fixes for .untilCancel()
lots of new cancellation tests, some of which are failing
* new Cancelled type that behaves like Rejected everywhere except for trifurcate
* token is now private again and vanishes on resolution or settlement
* proper support for tokens in future() and Promise()
* consistently unsubscribe from tokens on settlement
* further simplify (?) Actions by abstracting more things in a CancellableAction class
* optmise _resolve() for token cancellation between resolution and settlement
* renamed CancelToken::getRejected to getCancelled
* fix some cases where Rejections were not tracked
@bergus bergus mentioned this pull request Jul 11, 2016
and include link to official proposal
Fixes #1.
* Token composition is still synchronous, as it requires some trickery with
  returning flat arrays of subscription results.
* Subscriptions, finally, trifurcate, and coroutine cancellation all behave
  asynchronous now, which required some test rewrites.
* Action no longer auto-subscribes, as that may cause cancel to be called
  synchronously before subclass constructors are done with initialisation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant