-
Notifications
You must be signed in to change notification settings - Fork 5
/
index.d.ts
39 lines (28 loc) · 852 Bytes
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
export as namespace trkl;
export = trkl;
declare function trkl<T>(seed?: T): trkl.Observable<T>;
declare namespace trkl {
export function computed<T>(executor: Computation<T>): trkl.Observable<T>;
export function from(executor: Writer): trkl.Observable<any>;
interface Observable<T> {
(newValue: T): void; // write
(): T; // read
subscribe: AddSubscriber<T>;
unsubscribe: RemoveSubscriber;
}
interface Subscriber<T> {
(latest: T, last?: T): any | void;
}
interface AddSubscriber<T> {
(subscriber: Subscriber<T>, runImmediate?: boolean): void;
}
interface RemoveSubscriber {
(subscriber: Subscriber<any>): void;
}
interface Computation<T> {
(): T;
}
interface Writer {
(observable: trkl.Observable<any>): void;
}
}