MessageSubscription to consume.
Output MessageDispatcher to use.
Reducer function.
Initial state.
Protected
_stateWraps a MaybePromise-yielding coroutine (generator function) into a function that returns MaybePromise.
This allows you to use maybeAsync
/yield in a similar way to async/await,
where yield maybePromise
will return awaited / resolved value.
Rest
...args: [options?: AbortOptions]const add = maybeAsync(function* (a: number, b: number) {
const result1: number = yield Promise.resolve(a); // result1 === a
const result2 = yield b; // result2 === b
return result + result2;
});
const result = await add(1, 2); // result === 3
Protected
Readonly
consumerConsumer of messages.
Protected
Readonly
dispatcherOutput MessageDispatcher to use.
Wraps a MaybePromise-yielding coroutine (generator function) into a function that returns MaybePromise.
This allows you to use maybeAsync
/yield in a similar way to async/await,
where yield maybePromise
will return awaited / resolved value.
Rest
...args: [options?: AbortOptions]const add = maybeAsync(function* (a: number, b: number) {
const result1: number = yield Promise.resolve(a); // result1 === a
const result2 = yield b; // result2 === b
return result + result2;
});
const result = await add(1, 2); // result === 3
Protected
Readonly
subscriptionMessageSubscription to consume.
Returns if this has started.
Private
setGenerated using TypeDoc
MessageProcessor that derives aggregate state from messages.