|
| 1 | +import {Observable, Stream, Property, Event as KEvent, Pool} from 'kefir' |
| 2 | +import {Clock} from 'lolex' |
| 3 | + |
| 4 | +export type Event<V, E> = KEvent<V, E> & { |
| 5 | + current?: boolean |
| 6 | +} |
| 7 | + |
| 8 | +export type Options = {current: boolean} |
| 9 | + |
| 10 | +export type Watcher<V, E> = { |
| 11 | + log: Event<V, E>[] |
| 12 | + unwatch(): void |
| 13 | +} |
| 14 | + |
| 15 | +export interface Helpers { |
| 16 | + END: string |
| 17 | + VALUE: string |
| 18 | + ERROR: string |
| 19 | + send<V, E>(stream$: Observable<V, E>, values: Event<V, E>[]): Observable<V, E> |
| 20 | + value<V, E>(v: V, opts?: Options): Event<V, E> |
| 21 | + error<V, E>(e: E, opts?: Options): Event<V, E> |
| 22 | + end<V, E>(opts?: Options): Event<V, E> |
| 23 | + activate<V, E>(obs: Observable<V, E>): typeof obs |
| 24 | + deactivate<V, E>(obs: Observable<V, E>): typeof obs |
| 25 | + prop<V, E>(): Property<V, E> |
| 26 | + stream<V, E>(): Stream<V, E> |
| 27 | + pool<V, E>(): Pool<V, E> |
| 28 | + shakeTimers(clock: Clock): void |
| 29 | + withFakeTime(cb: (tick: (x: number) => void, clock: Clock) => void, reverseSimultaneous?: boolean): void |
| 30 | + logItem<V, E>(event: KEvent<V, E>, current: boolean): Event<V, E> |
| 31 | + watch<V, E>(obs: Observable<V, E>): Watcher<V, E> |
| 32 | + watchWithTime<V, E>(stream$: Observable<V, E>): Event<V, E>[] |
| 33 | +} |
| 34 | + |
| 35 | +export interface HelpersFactory { |
| 36 | + (Kefir: typeof import('kefir').default): Helpers |
| 37 | +} |
| 38 | + |
| 39 | +declare const createHelpers: HelpersFactory |
| 40 | + |
| 41 | +export default createHelpers |
0 commit comments