interface Contextthefrontside/effection
interface Context<T>
Context defines a value which is in effect for a given scope which is an
(action, resource, call, or spawn).
Unless a context value is defined for a particular scope, it will inherit its value from its parent scope.
Type Parameters
T
Properties
- name: string
- A unique identifier for this context. 
- defaultValue: T
- The value returned by this context when it is not present on a scop.e 
Methods
- get(): Operation<T | undefined>
- Read the current value of this context if it exists. 
- set(value: T): Operation<T>
- Set the value of a context on the current scope. It will not effect the value of its containing scope and will only be visible by this scope and its children. 
- expect(): Operation<T>
- Read the current value of the context or fail if it does not exist 
- delete(): Operation<boolean>
- Remove a context value from the current scope. This will only effect the current scope and not its parent value. 
- with<R>(value: T, operation: (value: T) => Operation<R>): Operation<R>
- Evaluate an operation using - valuefor the context. Once the operation is completed, the context will be reverted to its original value, or removed if it was not present originally.