Class: Reducer<T, A>
Type parameters
Name |
---|
T |
A |
Constructors
constructor
• new Reducer<T
, A
>(opts
)
Type parameters
Name |
---|
T |
A |
Parameters
Name | Type | Description |
---|---|---|
opts | Object | - |
opts.callback | (state : T ) => void | A callback function called when the state changes, either because of a local call to dispatch or a remote event. |
opts.db | DbConnection | The database connection to use. |
opts.initialValue | T | The initial state passed to the reducer. |
opts.key | string | A key identifying the stream to use for the reducer. |
opts.reducer | (state : T , action : A ) => T | The reducer function applied when dispatch is called. |
opts.sizeThreshold? | number | The number of messages to keep in the stream before compacting. |
Defined in
js-pkg/packages/driftdb/src/reducer.ts:23
Properties
compactor
• compactor: Compactor
<T
, A
>
Defined in
js-pkg/packages/driftdb/src/reducer.ts:21
Methods
destroy
▸ destroy(): void
Returns
void
Defined in
js-pkg/packages/driftdb/src/reducer.ts:58
dispatch
▸ dispatch(action
): void
Parameters
Name | Type |
---|---|
action | A |
Returns
void
Defined in
js-pkg/packages/driftdb/src/reducer.ts:62
subscribe
▸ subscribe(): void
Returns
void