1 | import {Stream, MemoryStream} from 'xstream';
|
2 |
|
3 | export interface FantasyObserver {
|
4 | next(x: any): void;
|
5 | error(err: any): void;
|
6 | complete(c?: any): void;
|
7 | }
|
8 |
|
9 | export interface FantasySubscription {
|
10 | unsubscribe(): void;
|
11 | }
|
12 |
|
13 | export interface FantasyObservable {
|
14 | subscribe(observer: FantasyObserver): FantasySubscription;
|
15 | }
|
16 |
|
17 | export interface DevToolEnabledSource {
|
18 | _isCycleSource: string;
|
19 | }
|
20 |
|
21 | export type Sources = {
|
22 | [name: string]: any;
|
23 | };
|
24 |
|
25 | export type Sinks = {
|
26 | [name: string]: any;
|
27 | };
|
28 |
|
29 |
|
30 |
|
31 |
|
32 |
|
33 |
|
34 |
|
35 |
|
36 |
|
37 |
|
38 |
|
39 |
|
40 |
|
41 |
|
42 |
|
43 |
|
44 | export type SinkProxies<Si extends Sinks> = {
|
45 | [P in keyof Si]: MemoryStream<any>
|
46 | };
|
47 |
|
48 | export type FantasySinks<Si> = {[S in keyof Si]: FantasyObservable};
|
49 |
|
50 | export interface Driver<Sink, Source> {
|
51 | (stream: Sink, driverName?: string): Source;
|
52 | }
|
53 |
|
54 | export type Drivers<So extends Sources, Si extends Sinks> = {
|
55 | [P in keyof (So & Si)]: Driver<Si[P], So[P]>
|
56 | };
|
57 |
|
58 | export type DisposeFunction = () => void;
|
59 |
|
60 | export interface CycleProgram<So extends Sources, Si extends Sinks> {
|
61 | sources: So;
|
62 | sinks: Si;
|
63 | run(): DisposeFunction;
|
64 | }
|