exectx
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

exectx

Stable Release Documentation Blazing Fast gzip size license


Check out the wiki page for exectx.

Classes

ContextExecution

A cancelable that holds mutable values and can inherit from other contexts and executions.

Execution

A cancelable that can inherit cancellation of other contexts and executions.

ExecutionSlotExecution

A cancelable that holds one execution simultaneously and cancels executions when replaced.

Functions

executionFunc(innerFunc, options)ExecutionFunc

Transforms a function so that it always receives an execution as the last argument and only runs the function for one execution at a time. That is, if the function returned from executionFunc(innerFunc) is called with an execution, such as (...args, executionA), and is later called with a different execution before the previous call has finished (or the returned promise has been resolved), such as (...args, executionB), the execution passed to the func will be canceled. On the other hand, if it's called with the same executionA, the same value will be returned as from the previous call.

executionResolve(options)RT | Promise.<(RT|void)>

Resolves the specified value and applies any specified options, such as formatting the resolved value, handling interruptions, using default executions, nesting executions properly, and so on. It is useful if you don't know if a value will be resolved synchronously or asynchronously, and returning a promise in case any of the specified options leads to any asynchronicity. It can also be used as a tool for resolving expensive values.

executionRun(execution, ...actions)RunReturnValue.<T>

Runs one or more actions for an execution and returns the value returned from the last action.

nestContext(options)Execution

Makes a child context that inherits cancellation-state and values from any number of parent(s). It can be pre-constructed by specifying a child or constructed using a custom constructor.

nestExecution(options)Execution

Makes a child execution that inherits cancellation-state from any number of parent(s). It can be pre-constructed by specifying a child or constructed using a customConstructor.

parseExecutionsArg(arg)Array.<Execution>

Parses loosely specified executions into an array of valid executions.

Authors


MIT License.

Package Sidebar

Install

npm i exectx

Weekly Downloads

4

Version

0.1.0

License

MIT

Unpacked Size

228 kB

Total Files

20

Last publish

Collaborators

  • ludvigalden