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

0.1.0 • Public • Published

exectx-react

Stable Release Documentation Blazing Fast gzip size license


Check out the wiki page for exectx-react.

Constants

defaultContext

The default React context that is used.

Functions

createContext(values, parent)ReactContext.<V>

Creates a React context for a {@linkcode Context}. It can be nested using the {@linkcode ContextProvider}.

useContext(context)Context

React hook for consuming a provided {@linkcode Context}.

useExecution(parent, deps)Execution

React hook for using an {@linkcode Execution} that is canceled when the component is unmounted.

useExecutionFunc(innerFunc, options, deps)ExecutionFunc

React hook for using an execution-dependent function and cancel any pending call when the component is unmounted.

useExecutionSlot(parent, deps)ExecutionSlot

React hook for using an {@linkcode ExecutionSlot} that is canceled when the component is unmounted or when the deps change.

useResolvedValue(options, deps)RT | undefined

React hook for using a resolved value and cancelling any pending resolution of the value when the component unmounts or when any of the specified deps change.

defaultContext

The default React context that is used.

Kind: global constant

createContext(values, parent) ⇒ ReactContext.<V>

Creates a React context for a {@linkcode Context}. It can be nested using the {@linkcode ContextProvider}.

Kind: global function
Returns: ReactContext.<V> -

The created React context.

Param Type Description
values V

Default values to set to the root context.

parent ContextParentArg.<V>

arent(s) to inherit values and/or cancellation state from.

useContext(context) ⇒ Context

React hook for consuming a provided {@linkcode Context}.

Kind: global function
Returns: Context -

The consumed context.


See
  • {@linkcode ContextProvider}
  • {@linkcode createReactContext}
Param Type Description
context ReactContext

The React context to consume. Defaults to the {@linkcode defaultContext}.

useExecution(parent, deps) ⇒ Execution

React hook for using an {@linkcode Execution} that is canceled when the component is unmounted.

Kind: global function
Returns: Execution -

The constructed execution.

Param Type Description
parent ExecutionsArg

If defined, the returned execution will be nested from the specified parent(s). If specified as an array and the deps are undefined, make sure to memoize the array.

deps ReadonlyArray

When identities of the deps change, the execution will be reconstructed.

useExecutionFunc(innerFunc, options, deps) ⇒ ExecutionFunc

React hook for using an execution-dependent function and cancel any pending call when the component is unmounted.

Kind: global function
Returns: ExecutionFunc -

The transformed execution func, which accepts an execution as the final optional parameter.

Param Type Description
innerFunc InnerExecutionFunc

Function that receives the passed parameters and an execution as the final parameter.

options ExecutionFuncOptions

Options for the behaviour of the execution function. For instance, these allow for using the previously returned value of the function if the arguments and the passed execution are deemed equal.

deps ReadonlyArray

When identities of the deps change, the execution func will be reconstructed, so make sure to specify these if the innerFunc or options depend on any changing variable.

useExecutionSlot(parent, deps) ⇒ ExecutionSlot

React hook for using an {@linkcode ExecutionSlot} that is canceled when the component is unmounted or when the deps change.

Kind: global function
Returns: ExecutionSlot -

The constructed execution slot.

Param Type Description
parent ExecutionsArg

If defined, the returned execution slot will be nested from the specified parent(s). If specified as an array and the deps are undefined, make sure to memoize the array.

deps ReadonlyArray

When identities of the deps change, the execution slot will be reconstructed.

useResolvedValue(options, deps) ⇒ RT | undefined

React hook for using a resolved value and cancelling any pending resolution of the value when the component unmounts or when any of the specified deps change.

Kind: global function
Returns: RT | undefined -

The resolved value, or undefined if it's currently being resolved.

Param Type Description
options ExecutionResolveOptions

Specifies how to resolve the value and configures the use of executions. If an executionSlot is specified, it will be canceled when the component unmounts or when the deps change.

deps ReadonlyArray

When identities of the deps change, the value will be resolved again. Should be defined if the options depend on any changing value.

Authors


MIT License.

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
0.1.03latest

Version History

VersionDownloads (Last 7 Days)Published
0.1.03

Package Sidebar

Install

npm i exectx-react

Weekly Downloads

3

Version

0.1.0

License

MIT

Unpacked Size

125 kB

Total Files

18

Last publish

Collaborators

  • ludvigalden