12345678910111213141516171819202122232425262728293031323334353637 |
- import { ActorContext, ActorRef, Behavior, EventObject } from './types';
- export declare function fromReducer<TState, TEvent extends EventObject>(transition: (state: TState, event: TEvent, actorContext: ActorContext<TEvent, TState>) => TState, initialState: TState): Behavior<TEvent, TState>;
- declare type PromiseEvents<T> = {
- type: 'fulfill';
- data: T;
- } | {
- type: 'reject';
- error: unknown;
- };
- declare type PromiseState<T> = {
- status: 'pending';
- data: undefined;
- error: undefined;
- } | {
- status: 'fulfilled';
- data: T;
- error: undefined;
- } | {
- status: 'rejected';
- data: undefined;
- error: any;
- };
- export declare function fromPromise<T>(promiseFn: () => Promise<T>): Behavior<PromiseEvents<T>, PromiseState<T>>;
- interface SpawnBehaviorOptions {
- id?: string;
- parent?: ActorRef<any>;
- }
- export declare function spawnBehavior<TEvent extends EventObject, TEmitted>(behavior: Behavior<TEvent, TEmitted>, options?: SpawnBehaviorOptions): ActorRef<TEvent, TEmitted>;
- export {};
|