mobx 4.9.4 → 4.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/lib/api/configure.d.ts +1 -0
- package/lib/api/object-api.d.ts +1 -0
- package/lib/api/observable.d.ts +1 -0
- package/lib/core/globalstate.d.ts +5 -0
- package/lib/mobx.es6.js +4322 -0
- package/lib/mobx.js +1170 -1173
- package/lib/mobx.js.flow +175 -160
- package/lib/mobx.min.js +1 -4
- package/lib/mobx.module.js +1115 -1118
- package/lib/mobx.umd.js +4252 -4441
- package/lib/mobx.umd.min.js +1 -4
- package/lib/types/observableset.d.ts +1 -1
- package/package.json +48 -42
- package/lib/mobx.min.js.map +0 -1
- package/lib/mobx.umd.min.js.map +0 -1
package/lib/mobx.js.flow
CHANGED
|
@@ -3,31 +3,31 @@
|
|
|
3
3
|
export type IObservableMapInitialValues<K, V> = IMapEntries<K, V> | KeyValueMap<V> | IMap<K, V>
|
|
4
4
|
|
|
5
5
|
export interface IMobxConfigurationOptions {
|
|
6
|
-
+enforceActions?: boolean | "strict" | "never" | "always" | "observed"
|
|
7
|
-
computedRequiresReaction?: boolean
|
|
8
|
-
isolateGlobalState?: boolean
|
|
9
|
-
disableErrorBoundaries?: boolean
|
|
10
|
-
arrayBuffer?: number
|
|
11
|
-
reactionScheduler?: (f: () => void) => void
|
|
6
|
+
+enforceActions?: boolean | "strict" | "never" | "always" | "observed";
|
|
7
|
+
computedRequiresReaction?: boolean;
|
|
8
|
+
isolateGlobalState?: boolean;
|
|
9
|
+
disableErrorBoundaries?: boolean;
|
|
10
|
+
arrayBuffer?: number;
|
|
11
|
+
reactionScheduler?: (f: () => void) => void;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
declare export function configure(options: IMobxConfigurationOptions): void
|
|
15
15
|
|
|
16
16
|
export interface IAutorunOptions {
|
|
17
|
-
delay?: number
|
|
18
|
-
name?: string
|
|
19
|
-
scheduler?: (callback: () => void) => any
|
|
20
|
-
onError?: (error: any) => void
|
|
17
|
+
delay?: number;
|
|
18
|
+
name?: string;
|
|
19
|
+
scheduler?: (callback: () => void) => any;
|
|
20
|
+
onError?: (error: any) => void;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
export interface IReactionOptions extends IAutorunOptions {
|
|
24
|
-
fireImmediately?: boolean
|
|
25
|
-
equals?: IEqualsComparer<any
|
|
24
|
+
fireImmediately?: boolean;
|
|
25
|
+
equals?: IEqualsComparer<any>;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
export interface IInterceptable<T> {
|
|
29
|
-
interceptors: IInterceptor<T>[] | any
|
|
30
|
-
intercept(handler: IInterceptor<T>): Lambda
|
|
29
|
+
interceptors: IInterceptor<T>[] | any;
|
|
30
|
+
intercept(handler: IInterceptor<T>): Lambda;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
export type IEqualsComparer<T> = (a: T, b: T) => boolean
|
|
@@ -39,131 +39,138 @@ export type IMapEntry<K, V> = [K, V]
|
|
|
39
39
|
export type IMapEntries<K, V> = IMapEntry<K, V>[]
|
|
40
40
|
|
|
41
41
|
export interface IMap<K, V> {
|
|
42
|
-
clear(): void
|
|
43
|
-
delete(key: K): boolean
|
|
44
|
-
forEach(callbackfn: (value: V, index: K, map: IMap<K, V>) => void, thisArg?: any): void
|
|
45
|
-
get(key: K): V | any
|
|
46
|
-
has(key: K): boolean
|
|
47
|
-
set(key: K, value?: V): any
|
|
48
|
-
size: number
|
|
42
|
+
clear(): void;
|
|
43
|
+
delete(key: K): boolean;
|
|
44
|
+
forEach(callbackfn: (value: V, index: K, map: IMap<K, V>) => void, thisArg?: any): void;
|
|
45
|
+
get(key: K): V | any;
|
|
46
|
+
has(key: K): boolean;
|
|
47
|
+
set(key: K, value?: V): any;
|
|
48
|
+
size: number;
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
declare export function isObservableMap(x: any): boolean
|
|
52
52
|
|
|
53
53
|
export interface IComputedValueOptions<T> {
|
|
54
|
+
get?: () => T;
|
|
55
|
+
set?: (value: T) => void;
|
|
56
|
+
name?: string;
|
|
57
|
+
equals?: IEqualsComparer<T>;
|
|
58
|
+
context?: any;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
type PropertyDescriptor<T> = {
|
|
62
|
+
enumerable?: boolean,
|
|
63
|
+
configurable?: boolean,
|
|
64
|
+
writable?: boolean,
|
|
65
|
+
value?: T,
|
|
54
66
|
get?: () => T,
|
|
55
|
-
set?: (value: T) => void
|
|
56
|
-
name?: string,
|
|
57
|
-
equals?: IEqualsComparer<T>,
|
|
58
|
-
context?: any
|
|
67
|
+
set?: (value: T) => void
|
|
59
68
|
}
|
|
60
69
|
|
|
61
|
-
declare type PropertyDescriptor = any
|
|
62
|
-
|
|
63
70
|
export interface IComputed {
|
|
64
|
-
<T>(func: () => T, setter?: (value: T) => void): IComputedValue<T
|
|
65
|
-
<T>(func: () => T, options: IComputedValueOptions<T>): IComputedValue<T
|
|
66
|
-
(target: Object, key: string, baseDescriptor?: PropertyDescriptor): void
|
|
67
|
-
struct(target: Object, key: string, baseDescriptor?: PropertyDescriptor): void
|
|
71
|
+
<T>(func: () => T, setter?: (value: T) => void): IComputedValue<T>;
|
|
72
|
+
<T>(func: () => T, options: IComputedValueOptions<T>): IComputedValue<T>;
|
|
73
|
+
(target: Object, key: string, baseDescriptor?: PropertyDescriptor<*>): void;
|
|
74
|
+
struct(target: Object, key: string, baseDescriptor?: PropertyDescriptor<*>): void;
|
|
68
75
|
}
|
|
69
76
|
|
|
70
77
|
export interface IDependencyTree {
|
|
71
|
-
name: string
|
|
72
|
-
dependencies?: IDependencyTree[]
|
|
78
|
+
name: string;
|
|
79
|
+
dependencies?: IDependencyTree[];
|
|
73
80
|
}
|
|
74
81
|
|
|
75
82
|
export interface IObserverTree {
|
|
76
|
-
name: string
|
|
77
|
-
observers?: IObserverTree[]
|
|
83
|
+
name: string;
|
|
84
|
+
observers?: IObserverTree[];
|
|
78
85
|
}
|
|
79
86
|
|
|
80
87
|
export interface IAtom {
|
|
81
|
-
reportObserved: () => void
|
|
82
|
-
reportChanged: () => void
|
|
88
|
+
reportObserved: () => void;
|
|
89
|
+
reportChanged: () => void;
|
|
83
90
|
}
|
|
84
91
|
|
|
85
92
|
export interface IComputedValue<T> {
|
|
86
|
-
get(): T
|
|
87
|
-
set(value: T): void
|
|
88
|
-
observe(listener: (newValue: T, oldValue: T) => void, fireImmediately?: boolean): Lambda
|
|
93
|
+
get(): T;
|
|
94
|
+
set(value: T): void;
|
|
95
|
+
observe(listener: (newValue: T, oldValue: T) => void, fireImmediately?: boolean): Lambda;
|
|
89
96
|
}
|
|
90
97
|
|
|
91
98
|
export interface IObservable {}
|
|
92
99
|
|
|
93
100
|
export interface IDepTreeNode {
|
|
94
|
-
name: string
|
|
95
|
-
observing?: IObservable[]
|
|
101
|
+
name: string;
|
|
102
|
+
observing?: IObservable[];
|
|
96
103
|
}
|
|
97
104
|
|
|
98
105
|
export interface IDerivation {
|
|
99
|
-
name: string
|
|
106
|
+
name: string;
|
|
100
107
|
}
|
|
101
108
|
|
|
102
109
|
export interface IReactionPublic {
|
|
103
|
-
dispose: () => void
|
|
104
|
-
trace: (enterBreakPoint?: boolean) => void
|
|
110
|
+
dispose: () => void;
|
|
111
|
+
trace: (enterBreakPoint?: boolean) => void;
|
|
105
112
|
}
|
|
106
113
|
|
|
107
114
|
declare export class IListenable {
|
|
108
|
-
observe(handler: (change: any, oldValue?: any) => void, fireImmediately?: boolean): Lambda
|
|
115
|
+
observe(handler: (change: any, oldValue?: any) => void, fireImmediately?: boolean): Lambda;
|
|
109
116
|
}
|
|
110
117
|
|
|
111
118
|
export interface IObservableArray<T> extends Array<T> {
|
|
112
|
-
spliceWithArray(index: number, deleteCount?: number, newItems?: T[]): T[]
|
|
119
|
+
spliceWithArray(index: number, deleteCount?: number, newItems?: T[]): T[];
|
|
113
120
|
observe(
|
|
114
121
|
listener: (changeData: IArrayChange<T> | IArraySplice<T>) => void,
|
|
115
122
|
fireImmediately?: boolean
|
|
116
|
-
): Lambda
|
|
117
|
-
intercept(handler: IInterceptor<IArrayWillChange<T> | IArrayWillSplice<T>>): Lambda
|
|
118
|
-
intercept(handler: IInterceptor<IArrayChange<T> | IArraySplice<T>>): Lambda
|
|
119
|
-
intercept<T>(handler: IInterceptor<IArrayChange<T> | IArraySplice<T>>): Lambda
|
|
120
|
-
clear(): T[]
|
|
121
|
-
peek(): T[]
|
|
122
|
-
replace(newItems: T[]): T[]
|
|
123
|
+
): Lambda;
|
|
124
|
+
intercept(handler: IInterceptor<IArrayWillChange<T> | IArrayWillSplice<T>>): Lambda;
|
|
125
|
+
intercept(handler: IInterceptor<IArrayChange<T> | IArraySplice<T>>): Lambda; // TODO: remove in 4.0
|
|
126
|
+
intercept<T>(handler: IInterceptor<IArrayChange<T> | IArraySplice<T>>): Lambda; // TODO: remove in 4.0
|
|
127
|
+
clear(): T[];
|
|
128
|
+
peek(): T[];
|
|
129
|
+
replace(newItems: T[]): T[];
|
|
123
130
|
find(
|
|
124
131
|
predicate: (item: T, index: number, array: Array<T>) => boolean,
|
|
125
132
|
thisArg?: any,
|
|
126
133
|
fromIndex?: number
|
|
127
|
-
): T | any
|
|
134
|
+
): T | any;
|
|
128
135
|
findIndex(
|
|
129
136
|
predicate: (item: T, index: number, array: Array<T>) => boolean,
|
|
130
137
|
thisArg?: any,
|
|
131
138
|
fromIndex?: number
|
|
132
|
-
): number
|
|
133
|
-
remove(value: T): boolean
|
|
139
|
+
): number;
|
|
140
|
+
remove(value: T): boolean;
|
|
134
141
|
}
|
|
135
142
|
|
|
136
143
|
export interface IArrayChange<T> {
|
|
137
|
-
type: "update"
|
|
138
|
-
object: IObservableArray<T
|
|
139
|
-
index: number
|
|
140
|
-
newValue: T
|
|
141
|
-
oldValue: T
|
|
144
|
+
type: "update";
|
|
145
|
+
object: IObservableArray<T>;
|
|
146
|
+
index: number;
|
|
147
|
+
newValue: T;
|
|
148
|
+
oldValue: T;
|
|
142
149
|
}
|
|
143
150
|
|
|
144
151
|
export interface IArraySplice<T> {
|
|
145
|
-
type: "splice"
|
|
146
|
-
object: IObservableArray<T
|
|
147
|
-
index: number
|
|
148
|
-
added: T[]
|
|
149
|
-
addedCount: number
|
|
150
|
-
removed: T[]
|
|
151
|
-
removedCount: number
|
|
152
|
+
type: "splice";
|
|
153
|
+
object: IObservableArray<T>;
|
|
154
|
+
index: number;
|
|
155
|
+
added: T[];
|
|
156
|
+
addedCount: number;
|
|
157
|
+
removed: T[];
|
|
158
|
+
removedCount: number;
|
|
152
159
|
}
|
|
153
160
|
|
|
154
161
|
export interface IArrayWillChange<T> {
|
|
155
|
-
type: "update"
|
|
156
|
-
object: IObservableArray<T
|
|
157
|
-
index: number
|
|
158
|
-
newValue: T
|
|
162
|
+
type: "update";
|
|
163
|
+
object: IObservableArray<T>;
|
|
164
|
+
index: number;
|
|
165
|
+
newValue: T;
|
|
159
166
|
}
|
|
160
167
|
|
|
161
168
|
export interface IArrayWillSplice<T> {
|
|
162
|
-
type: "splice"
|
|
163
|
-
object: IObservableArray<T
|
|
164
|
-
index: number
|
|
165
|
-
added: T[]
|
|
166
|
-
removedCount: number
|
|
169
|
+
type: "splice";
|
|
170
|
+
object: IObservableArray<T>;
|
|
171
|
+
index: number;
|
|
172
|
+
added: T[];
|
|
173
|
+
removedCount: number;
|
|
167
174
|
}
|
|
168
175
|
|
|
169
176
|
export type KeyValueMap<V> = {
|
|
@@ -171,70 +178,70 @@ export type KeyValueMap<V> = {
|
|
|
171
178
|
}
|
|
172
179
|
|
|
173
180
|
export interface IMapChange<K, T> {
|
|
174
|
-
object: ObservableMap<K, T
|
|
175
|
-
type: "update" | "add" | "delete"
|
|
176
|
-
name: K
|
|
177
|
-
newValue?: any
|
|
178
|
-
oldValue?: any
|
|
181
|
+
object: ObservableMap<K, T>;
|
|
182
|
+
type: "update" | "add" | "delete";
|
|
183
|
+
name: K;
|
|
184
|
+
newValue?: any;
|
|
185
|
+
oldValue?: any;
|
|
179
186
|
}
|
|
180
187
|
|
|
181
188
|
export interface IMapWillChange<K, T> {
|
|
182
|
-
object: ObservableMap<K, T
|
|
183
|
-
type: "update" | "add" | "delete"
|
|
184
|
-
name: K
|
|
185
|
-
newValue?: any
|
|
189
|
+
object: ObservableMap<K, T>;
|
|
190
|
+
type: "update" | "add" | "delete";
|
|
191
|
+
name: K;
|
|
192
|
+
newValue?: any;
|
|
186
193
|
}
|
|
187
194
|
|
|
188
195
|
export interface IObservableObject {}
|
|
189
196
|
|
|
190
197
|
export interface IObjectChange {
|
|
191
|
-
name: string
|
|
192
|
-
object: any
|
|
193
|
-
type: "update" | "add" | "remove"
|
|
194
|
-
oldValue?: any
|
|
195
|
-
newValue: any
|
|
198
|
+
name: string;
|
|
199
|
+
object: any;
|
|
200
|
+
type: "update" | "add" | "remove";
|
|
201
|
+
oldValue?: any;
|
|
202
|
+
newValue: any;
|
|
196
203
|
}
|
|
197
204
|
|
|
198
205
|
export interface IObjectWillChange {
|
|
199
|
-
object: any
|
|
200
|
-
type: "update" | "add" | "remove"
|
|
201
|
-
name: string
|
|
202
|
-
newValue: any
|
|
206
|
+
object: any;
|
|
207
|
+
type: "update" | "add" | "remove";
|
|
208
|
+
name: string;
|
|
209
|
+
newValue: any;
|
|
203
210
|
}
|
|
204
211
|
|
|
205
212
|
export interface IValueWillChange<T> {
|
|
206
|
-
object: any
|
|
207
|
-
type: "update"
|
|
208
|
-
newValue: T
|
|
213
|
+
object: any;
|
|
214
|
+
type: "update";
|
|
215
|
+
newValue: T;
|
|
209
216
|
}
|
|
210
217
|
|
|
211
218
|
export interface IValueDidChange<T> extends IValueWillChange<T> {
|
|
212
|
-
oldValue: ?T
|
|
219
|
+
oldValue: ?T;
|
|
213
220
|
}
|
|
214
221
|
|
|
215
222
|
export interface IObservableValue<T> {
|
|
216
|
-
get(): T
|
|
217
|
-
set(value: T): void
|
|
218
|
-
intercept(handler: IInterceptor<IValueWillChange<T>>): Lambda
|
|
219
|
-
observe(listener: (change: IValueDidChange<T>) => void, fireImmediately?: boolean): Lambda
|
|
223
|
+
get(): T;
|
|
224
|
+
set(value: T): void;
|
|
225
|
+
intercept(handler: IInterceptor<IValueWillChange<T>>): Lambda;
|
|
226
|
+
observe(listener: (change: IValueDidChange<T>) => void, fireImmediately?: boolean): Lambda;
|
|
220
227
|
}
|
|
221
228
|
|
|
222
229
|
export interface IEnhancer<T> {
|
|
223
|
-
(newValue: T, oldValue: T | void, name: string): T
|
|
230
|
+
(newValue: T, oldValue: T | void, name: string): T;
|
|
224
231
|
}
|
|
225
232
|
|
|
226
233
|
export interface IObservableFactory {
|
|
227
234
|
// observable overloads
|
|
228
|
-
(target: Object, key: string, baseDescriptor?: PropertyDescriptor): any
|
|
229
|
-
<T>(value: Array<T>): IObservableArray<T
|
|
230
|
-
<T>(value: null | void): IObservableValue<T
|
|
231
|
-
(value: null | void): IObservableValue<any
|
|
232
|
-
<T>(value: IMap<string | number | boolean, T>): ObservableMap<T
|
|
233
|
-
<T: Object>(value: T): T
|
|
235
|
+
(target: Object, key: string, baseDescriptor?: PropertyDescriptor<*>): any;
|
|
236
|
+
<T>(value: Array<T>): IObservableArray<T>;
|
|
237
|
+
<T>(value: null | void): IObservableValue<T>;
|
|
238
|
+
(value: null | void): IObservableValue<any>;
|
|
239
|
+
<T>(value: IMap<string | number | boolean, T>): ObservableMap<T>;
|
|
240
|
+
<T: Object>(value: T): T;
|
|
234
241
|
}
|
|
235
242
|
|
|
236
243
|
export type IObservableDecorator = {
|
|
237
|
-
(target: Object, property: string, descriptor?: PropertyDescriptor): void,
|
|
244
|
+
(target: Object, property: string, descriptor?: PropertyDescriptor<*>): void,
|
|
238
245
|
enhancer: IEnhancer<any>
|
|
239
246
|
}
|
|
240
247
|
|
|
@@ -245,58 +252,66 @@ export type CreateObservableOptions = {
|
|
|
245
252
|
}
|
|
246
253
|
|
|
247
254
|
declare export class IObservableFactories {
|
|
248
|
-
box<T>(value?: T, options?: CreateObservableOptions): IObservableValue<T
|
|
249
|
-
array<T>(initialValues?: T[], options?: CreateObservableOptions): IObservableArray<T
|
|
255
|
+
box<T>(value?: T, options?: CreateObservableOptions): IObservableValue<T>;
|
|
256
|
+
array<T>(initialValues?: T[], options?: CreateObservableOptions): IObservableArray<T>;
|
|
250
257
|
map<K, V>(
|
|
251
258
|
initialValues?: IObservableMapInitialValues<K, V>,
|
|
252
259
|
options?: CreateObservableOptions
|
|
253
|
-
): ObservableMap<K, V
|
|
254
|
-
object<T>(props: T, options?: CreateObservableOptions): T & IObservableObject
|
|
255
|
-
ref(
|
|
260
|
+
): ObservableMap<K, V>;
|
|
261
|
+
object<T>(props: T, options?: CreateObservableOptions): T & IObservableObject;
|
|
262
|
+
ref(
|
|
263
|
+
target: Object,
|
|
264
|
+
property?: string,
|
|
265
|
+
descriptor?: PropertyDescriptor<*>
|
|
266
|
+
): IObservableDecorator;
|
|
256
267
|
shallow(
|
|
257
268
|
target: Object,
|
|
258
269
|
property?: string,
|
|
259
|
-
descriptor?: PropertyDescriptor
|
|
260
|
-
): IObservableDecorator
|
|
261
|
-
deep(
|
|
270
|
+
descriptor?: PropertyDescriptor<*>
|
|
271
|
+
): IObservableDecorator;
|
|
272
|
+
deep(
|
|
273
|
+
target: Object,
|
|
274
|
+
property?: string,
|
|
275
|
+
descriptor?: PropertyDescriptor<*>
|
|
276
|
+
): IObservableDecorator;
|
|
262
277
|
}
|
|
263
278
|
|
|
264
279
|
export interface Lambda {
|
|
265
|
-
(): void
|
|
266
|
-
name?: string
|
|
280
|
+
(): void;
|
|
281
|
+
name?: string;
|
|
267
282
|
}
|
|
268
283
|
|
|
269
284
|
export interface IActionFactory {
|
|
270
|
-
(a1: any, a2?: any, a3?: any, a4?: any, a6?: any): any
|
|
271
|
-
bound(target: Object, propertyKey: string, descriptor?: PropertyDescriptor): void
|
|
285
|
+
(a1: any, a2?: any, a3?: any, a4?: any, a6?: any): any;
|
|
286
|
+
bound(target: Object, propertyKey: string, descriptor?: PropertyDescriptor<*>): void;
|
|
272
287
|
}
|
|
273
288
|
|
|
274
289
|
declare export class ObservableMap<K, V> {
|
|
275
|
-
constructor(initialData?: IMapEntries<K, V> | KeyValueMap<V>, valueModeFunc?: Function): this
|
|
276
|
-
has(key: K): boolean
|
|
277
|
-
set(key: K, value: V): void
|
|
278
|
-
delete(key: K): boolean
|
|
279
|
-
get(key: K): V
|
|
280
|
-
keys(): Iterator<K
|
|
281
|
-
values(): Iterator<V
|
|
282
|
-
entries(): IMapEntries<K, V> & Iterator<IMapEntry<K, V
|
|
283
|
-
forEach(callback: (value: V, key: K, object: KeyValueMap<K, V>) => void, thisArg?: any): void
|
|
284
|
-
merge(other: ObservableMap<K, V> | KeyValueMap<K, V>): ObservableMap<K, V
|
|
285
|
-
clear(): void
|
|
286
|
-
replace(other: ObservableMap<K, V> | KeyValueMap<K, V>): ObservableMap<K, V
|
|
287
|
-
size: number
|
|
288
|
-
toJS(): Map<K, V
|
|
289
|
-
toPOJO(): KeyValueMap<V
|
|
290
|
-
toJSON(): KeyValueMap<V
|
|
291
|
-
toString(): string
|
|
292
|
-
observe(listener: (changes: IMapChange<K, V>) => void, fireImmediately?: boolean): Lambda
|
|
293
|
-
intercept(handler: IInterceptor<IMapWillChange<K, V>>): Lambda
|
|
290
|
+
constructor(initialData?: IMapEntries<K, V> | KeyValueMap<V>, valueModeFunc?: Function): this;
|
|
291
|
+
has(key: K): boolean;
|
|
292
|
+
set(key: K, value: V): void;
|
|
293
|
+
delete(key: K): boolean;
|
|
294
|
+
get(key: K): V;
|
|
295
|
+
keys(): Iterator<K>;
|
|
296
|
+
values(): Iterator<V>;
|
|
297
|
+
entries(): IMapEntries<K, V> & Iterator<IMapEntry<K, V>>;
|
|
298
|
+
forEach(callback: (value: V, key: K, object: KeyValueMap<K, V>) => void, thisArg?: any): void;
|
|
299
|
+
merge(other: ObservableMap<K, V> | KeyValueMap<K, V>): ObservableMap<K, V>;
|
|
300
|
+
clear(): void;
|
|
301
|
+
replace(other: ObservableMap<K, V> | KeyValueMap<K, V>): ObservableMap<K, V>;
|
|
302
|
+
size: number;
|
|
303
|
+
toJS(): Map<K, V>;
|
|
304
|
+
toPOJO(): KeyValueMap<V>;
|
|
305
|
+
toJSON(): KeyValueMap<V>;
|
|
306
|
+
toString(): string;
|
|
307
|
+
observe(listener: (changes: IMapChange<K, V>) => void, fireImmediately?: boolean): Lambda;
|
|
308
|
+
intercept(handler: IInterceptor<IMapWillChange<K, V>>): Lambda;
|
|
294
309
|
}
|
|
295
310
|
|
|
296
311
|
declare export function action(
|
|
297
312
|
targetOrName: any,
|
|
298
313
|
propertyKeyOrFuc?: any,
|
|
299
|
-
descriptor?: PropertyDescriptor
|
|
314
|
+
descriptor?: PropertyDescriptor<*>
|
|
300
315
|
): any
|
|
301
316
|
declare export function action<T>(name: string, func: T): T
|
|
302
317
|
declare export function action<T>(func: T): T
|
|
@@ -315,9 +330,9 @@ declare export function reaction<T>(
|
|
|
315
330
|
): () => mixed
|
|
316
331
|
|
|
317
332
|
export interface IWhenOptions {
|
|
318
|
-
name?: string
|
|
319
|
-
timeout?: number
|
|
320
|
-
onError?: (error: any) => void
|
|
333
|
+
name?: string;
|
|
334
|
+
timeout?: number;
|
|
335
|
+
onError?: (error: any) => void;
|
|
321
336
|
}
|
|
322
337
|
|
|
323
338
|
declare export function when(
|
|
@@ -330,7 +345,7 @@ declare export function when(cond: () => boolean, options?: IWhenOptions): Promi
|
|
|
330
345
|
declare export function computed<T>(
|
|
331
346
|
target: any,
|
|
332
347
|
key?: string,
|
|
333
|
-
baseDescriptor?: PropertyDescriptor
|
|
348
|
+
baseDescriptor?: PropertyDescriptor<*>
|
|
334
349
|
): any
|
|
335
350
|
|
|
336
351
|
declare export function extendObservable<A, B>(
|
|
@@ -402,8 +417,8 @@ declare export function observe(
|
|
|
402
417
|
): Lambda
|
|
403
418
|
|
|
404
419
|
export interface ToJSOptions {
|
|
405
|
-
detectCycles?: boolean
|
|
406
|
-
exportMapsAsObjects?: boolean
|
|
420
|
+
detectCycles?: boolean;
|
|
421
|
+
exportMapsAsObjects?: boolean;
|
|
407
422
|
}
|
|
408
423
|
|
|
409
424
|
declare export function toJS<T>(source: T, options?: ToJSOptions): T
|
|
@@ -421,18 +436,18 @@ declare export function isObservableObject<T>(thing: T): boolean
|
|
|
421
436
|
declare export function isArrayLike(x: any): boolean
|
|
422
437
|
|
|
423
438
|
declare export class Reaction {
|
|
424
|
-
name: string
|
|
425
|
-
isDisposed: boolean
|
|
426
|
-
constructor(name: string, onInvalidate: () => void): this
|
|
427
|
-
schedule(): void
|
|
428
|
-
isScheduled(): boolean
|
|
429
|
-
track(fn: () => void): void
|
|
430
|
-
dispose(): void
|
|
439
|
+
name: string;
|
|
440
|
+
isDisposed: boolean;
|
|
441
|
+
constructor(name: string, onInvalidate: () => void): this;
|
|
442
|
+
schedule(): void;
|
|
443
|
+
isScheduled(): boolean;
|
|
444
|
+
track(fn: () => void): void;
|
|
445
|
+
dispose(): void;
|
|
431
446
|
getDisposer(): Lambda & {
|
|
432
447
|
$mosbservable: Reaction
|
|
433
|
-
}
|
|
434
|
-
toString(): string
|
|
435
|
-
trace(enterBreakPoint?: boolean): void
|
|
448
|
+
};
|
|
449
|
+
toString(): string;
|
|
450
|
+
trace(enterBreakPoint?: boolean): void;
|
|
436
451
|
}
|
|
437
452
|
|
|
438
453
|
declare export function createAtom(
|