An abort signal whose aborted property is set to true
if the listener execution is either aborted or completed.
Returns a promise that resolves when the input predicate returns true or
rejects if the listener has been cancelled or is completed.
The return value is the [action, currentState, previousState] combination that the predicate saw as arguments.
The promise resolves to null if a timeout is provided and expires first,
const updateBy = createAction<number>('counter/updateBy');
middleware.startListening({
actionCreator: updateBy,
async effect(_, { take }) {
const [{ payload }] = await take(updateBy.match);
console.log(payload); // logs 5;
}
})
store.dispatch(updateBy(5));
Cancels all other running instances of this same listener except for the one that made this call.
Returns a promise that resolves after timeoutMs or
rejects if the listener has been cancelled or is completed.
Queues in the next microtask the execution of a task.
Returns the store state as it existed when the action was originally dispatched, before the reducers ran.
This function can only be invoked synchronously, it throws error otherwise.
Returns a promise that resolves when waitFor resolves or
rejects if the listener has been cancelled or is completed.
It will subscribe a listener if it was previously removed, noop otherwise.
Removes the listener entry from the middleware and prevent future instances of the listener from running.
It does not cancel any active instances.
Generated using TypeDoc
Returns a promise that resolves when the input predicate returns
trueor rejects if the listener has been cancelled or is completed.The return value is
trueif the predicate succeeds orfalseif a timeout is provided and expires first.Example