import type { NotUndefined, PrimitiveObject } from '../libs/bemedev/globals/types'; import type { ActorsConfigMap, EventObject } from '../events/index.js'; import type { StateExtended } from '../states/index.js'; import type { Transition } from '../transitions/index.js'; import type { RecordS } from '../types/index.js'; export type Subscriber = { unsubscribe: () => void; }; export type Subscribable = { subscribe: Subscriber; }; /** * Observer wired into a {@linkcode Pausable} via its `subscribe` method. * Mirrors the shape expected by `@bemedev/rx-pausable`'s SubArgs. */ export type EmitterObserver = { next: (value: R) => void; error: (err: any) => void; complete: () => void; }; /** * Minimal pausable interface — intentionally framework-agnostic so the lib * does not pull in RxJS as a peer dependency. * * Implementations (e.g. the class returned by `createPausable` from * `@bemedev/rx-pausable`) must satisfy this shape. * * @template R - The value type emitted by the underlying source. */ export type Pausable = { /** Wire the observer that will receive forwarded events. */ subscribe: (observer: EmitterObserver) => void; /** Start consuming the source — has no effect if not stopped. */ start: () => void; /** Stop the stream and remove any pending timers. */ stop: () => void; /** * Suspend forwarding while buffering incoming events. * Has no effect if already paused or stopped. */ pause: () => void; /** * Replay buffered events then resume live forwarding. * Has no effect if not paused. */ resume: () => void; }; /** The string id that references an emitter source in the options map. */ export type EmitterSrcConfig = string; export type EmitterDef = { next: PrimitiveObject; error: PrimitiveObject; }; export type EmitterConfigMap = RecordS; export type Emitter = { src: EmitterFunction2; description?: string; next: Transition[]; error: Transition[]; complete: Transition[]; }; export type EmitterReturn = NotUndefined[K]['next'] extends infer P ? unknown extends P ? never : P : never; export type EmitterFunction2 = (state: StateExtended) => Pausable; export type EmittersMap = RecordS>; //# sourceMappingURL=types.d.ts.map