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

allow handlers to control Promise behavior when converting signals to Promises #24

Closed
eudaimos opened this issue Jun 30, 2020 · 1 comment
Labels
devxp development experience pkg: utils corresponds to the @tao.js/utils package

Comments

@eudaimos
Copy link
Contributor

A Transponder is a simple mechanism to convert signals to Promises by resolving the Promise with the AppCon used by first handler of the wrapped network. Promises are only rejected if the specified timeout passed to the constructor is reached.

There may be scenarios where Network configurations want more control and to use individual handlers to determine how to conclude a Promise through a return value for resolving or throwing errors to reject.

eudaimos added a commit that referenced this issue Jun 30, 2020
…version of signals

affects: @tao.js/utils

using a Transceiver you can control how a Promise behaves using handlers attached to the
Transceiver.

The API works as follows:

* any handler THROW will REJECT the Promise
* any AppCtx returned from a handler will CHAIN back into the wrapped Network
* a TRUTHY value returned from an Intercept handler will REJECT the Promise
* any value not null or undefined returned from an Async or Inline handler will RESOLVE the Promise
* only the first thing to happen will conclude the Promise

ISSUES CLOSED: #22, #24
@eudaimos
Copy link
Contributor Author

closed by f6e5959

@eudaimos eudaimos added devxp development experience pkg: utils corresponds to the @tao.js/utils package labels Jun 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
devxp development experience pkg: utils corresponds to the @tao.js/utils package
Projects
None yet
Development

No branches or pull requests

1 participant