1 |
|
2 |
|
3 |
|
4 | export declare abstract class Event<V> {
|
5 | id: number;
|
6 |
|
7 | isEvent: boolean;
|
8 |
|
9 | _isEvent: boolean;
|
10 | isEnd: boolean;
|
11 | isInitial: boolean;
|
12 | isNext: boolean;
|
13 | isError: boolean;
|
14 | hasValue: boolean;
|
15 |
|
16 | filter(f: (value: V) => boolean): boolean;
|
17 |
|
18 | inspect(): string;
|
19 |
|
20 | log(): any;
|
21 |
|
22 | toNext(): Event<V>;
|
23 |
|
24 | abstract fmap<V2>(f: (value: V) => V2): Event<V2>;
|
25 | }
|
26 | /**
|
27 | * Base class for all [Events](event.html) carrying a value.
|
28 | *
|
29 | * Can be distinguished from other events using [hasValue](../globals.html#hasvalue)
|
30 | **/
|
31 | export declare abstract class Value<V> extends Event<V> {
|
32 | value: V;
|
33 | hasValue: boolean;
|
34 | constructor(value: V);
|
35 | /** @hidden */
|
36 | fmap<V2>(f: (value: V) => V2): Value<V2>;
|
37 | /** @hidden */
|
38 | filter(f: (value: V) => boolean): boolean;
|
39 | /** @hidden */
|
40 | toString(): string;
|
41 | /** @hidden */
|
42 | log(): any;
|
43 | /** @hidden */
|
44 | abstract apply<V2>(value: V2): Value<V2>;
|
45 | }
|
46 | /**
|
47 | * Indicates a new value in an [EventStream](eventstream.html) or a [Property](property.html).
|
48 | *
|
49 | * Can be distinguished from other events using [isNext](../globals.html#isnext)
|
50 | */
|
51 | export declare class Next<V> extends Value<V> {
|
52 | constructor(value: V);
|
53 | /** @hidden */
|
54 | apply<V2>(value: V2): Next<V2>;
|
55 | isNext: boolean;
|
56 | /** @hidden */
|
57 | _isNext: boolean;
|
58 | }
|
59 | /**
|
60 | * An event carrying the initial value of a [Property](classes/property.html). This event can be emitted by a property
|
61 | * immediately when subscribing to it.
|
62 | *
|
63 | * Can be distinguished from other events using [isInitial](../globals.html#isinitial)
|
64 | */
|
65 | export declare class Initial<V> extends Value<V> {
|
66 | constructor(value: V);
|
67 | /** @hidden */
|
68 | apply<V2>(value: V2): Initial<V2>;
|
69 | isInitial: boolean;
|
70 | /** @hidden */
|
71 | _isInitial: boolean;
|
72 | /** @hidden */
|
73 | toNext(): Next<V>;
|
74 | }
|
75 | /**
|
76 | * Base class for events not carrying a value.
|
77 | */
|
78 | export declare abstract class NoValue extends Event<any> {
|
79 | /** @hidden */
|
80 | fmap<V2>(f: Function): NoValue;
|
81 | hasValue: boolean;
|
82 | }
|
83 | /**
|
84 | * An event that indicates the end of an [EventStream](classes/eventstream.html) or a [Property](classes/property.html).
|
85 | * No more events can be emitted after this one.
|
86 | *
|
87 | * Can be distinguished from other events using [isEnd](../globals.html#isend)
|
88 | */
|
89 | export declare class End extends NoValue {
|
90 | isEnd: boolean;
|
91 | /** @hidden */
|
92 | toString(): string;
|
93 | }
|
94 | /**
|
95 | * An event carrying an error. You can use [onError](observable.html#onerror) to subscribe to errors.
|
96 | */
|
97 | export declare class Error extends NoValue {
|
98 | /**
|
99 | * The actual error object carried by this event
|
100 | */
|
101 | error: any;
|
102 | constructor(error: any);
|
103 | isError: boolean;
|
104 | /** @hidden */
|
105 | toString(): string;
|
106 | }
|
107 | /** @hidden */
|
108 | export declare function initialEvent<V>(value: V): Initial<V>;
|
109 | /** @hidden */
|
110 | export declare function nextEvent<V>(value: V): Next<V>;
|
111 | /** @hidden */
|
112 | export declare function endEvent(): End;
|
113 | /** @hidden */
|
114 | export declare function toEvent<V>(x: V | Event<V>): Event<V>;
|
115 | export default Event;
|
116 | /**
|
117 | * Returns true if the given object is an [Event](classes/event.html).
|
118 | */
|
119 | export declare function isEvent<V>(e: any): e is Event<V>;
|
120 | /**
|
121 | * Returns true if the given event is an [Initial](classes/initial.html) value of a [Property](classes/property.html).
|
122 | */
|
123 | export declare function isInitial<V>(e: Event<V>): e is Initial<V>;
|
124 | /**
|
125 | * Returns true if the given event is an [Error](classes/error.html) event of an [Observable](classes/observable.html).
|
126 | */
|
127 | export declare function isError<V>(e: Event<V>): e is Error;
|
128 | /**
|
129 | * Returns true if the given event is a [Value](classes/value.html), i.e. a [Next](classes/next.html) or
|
130 | * an [Initial](classes/error.html) value of an [Observable](classes/observable.html).
|
131 | */
|
132 | export declare function hasValue<V>(e: Event<V>): e is Value<V>;
|
133 | /**
|
134 | * Returns true if the given event is an [End](classes/end.html)
|
135 | */
|
136 | export declare function isEnd<V>(e: Event<V>): e is End;
|
137 | /**
|
138 | * Returns true if the given event is a [Next](classes/next.html)
|
139 | */
|
140 | export declare function isNext<V>(e: Event<V>): e is Next<V>;
|
141 |
|
\ | No newline at end of file |