mobx 6.0.3 → 6.0.4
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/CHANGELOG.md +6 -0
- package/dist/mobx.cjs.development.js +11 -2
- package/dist/mobx.cjs.development.js.map +1 -1
- package/dist/mobx.cjs.production.min.js +1 -1
- package/dist/mobx.cjs.production.min.js.map +1 -1
- package/dist/mobx.esm.development.js +9 -2
- package/dist/mobx.esm.development.js.map +1 -1
- package/dist/mobx.esm.js +9 -2
- package/dist/mobx.esm.js.map +1 -1
- package/dist/mobx.esm.production.min.js +1 -1
- package/dist/mobx.esm.production.min.js.map +1 -1
- package/dist/mobx.umd.development.js +11 -2
- package/dist/mobx.umd.development.js.map +1 -1
- package/dist/mobx.umd.production.min.js +1 -1
- package/dist/mobx.umd.production.min.js.map +1 -1
- package/package.json +17 -15
- package/src/types/observableobject.ts +8 -3
- package/dist/index.js.flow +0 -591
package/package.json
CHANGED
|
@@ -1,15 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mobx",
|
|
3
|
-
"version": "6.0.
|
|
3
|
+
"version": "6.0.4",
|
|
4
4
|
"description": "Simple, scalable state management.",
|
|
5
|
+
"source": "src/mobx.ts",
|
|
5
6
|
"main": "dist/index.js",
|
|
6
|
-
"module": "dist/mobx.esm.js",
|
|
7
7
|
"umd:main": "dist/mobx.umd.production.min.js",
|
|
8
8
|
"unpkg": "dist/mobx.umd.production.min.js",
|
|
9
|
-
"
|
|
9
|
+
"jsdelivr": "dist/mobx.umd.production.min.js",
|
|
10
|
+
"jsnext:main": "dist/mobx.esm.production.min.js",
|
|
11
|
+
"module": "dist/mobx.esm.js",
|
|
10
12
|
"react-native": "dist/mobx.esm.js",
|
|
11
|
-
"
|
|
13
|
+
"types": "dist/mobx.d.ts",
|
|
12
14
|
"typings": "dist/mobx.d.ts",
|
|
15
|
+
"files": [
|
|
16
|
+
"src",
|
|
17
|
+
"dist",
|
|
18
|
+
"LICENSE",
|
|
19
|
+
"CHANGELOG.md",
|
|
20
|
+
"README.md"
|
|
21
|
+
],
|
|
13
22
|
"sideEffects": false,
|
|
14
23
|
"repository": {
|
|
15
24
|
"type": "git",
|
|
@@ -24,13 +33,6 @@
|
|
|
24
33
|
"bugs": {
|
|
25
34
|
"url": "https://github.com/mobxjs/mobx/issues"
|
|
26
35
|
},
|
|
27
|
-
"files": [
|
|
28
|
-
"src",
|
|
29
|
-
"dist",
|
|
30
|
-
"LICENSE",
|
|
31
|
-
"CHANGELOG.md",
|
|
32
|
-
"README.md"
|
|
33
|
-
],
|
|
34
36
|
"homepage": "https://mobx.js.org/",
|
|
35
37
|
"dependencies": {},
|
|
36
38
|
"devDependencies": {
|
|
@@ -61,15 +63,15 @@
|
|
|
61
63
|
"scripts": {
|
|
62
64
|
"test": "jest",
|
|
63
65
|
"lint": "eslint src/**/*",
|
|
64
|
-
"build": "node scripts/build.js",
|
|
66
|
+
"build": "node ../../scripts/build.js mobx",
|
|
67
|
+
"build:test": "yarn build --target test",
|
|
65
68
|
"perf": "scripts/perf.sh",
|
|
66
69
|
"test:performance": "yarn perf proxy && yarn perf legacy",
|
|
67
70
|
"test:mixed-versions": "yarn test --testRegex mixed-versions",
|
|
68
|
-
"test:
|
|
69
|
-
"test:types": "tsc --noEmit && yarn test:flow",
|
|
71
|
+
"test:types": "tsc --noEmit",
|
|
70
72
|
"test:flow": "flow check",
|
|
71
73
|
"test:coverage": "yarn test -i --coverage",
|
|
72
74
|
"test:size": "yarn import-size --report . observable computed autorun action",
|
|
73
|
-
"prepublish": "yarn build publish"
|
|
75
|
+
"prepublish": "node ./scripts/prepublish.js && yarn build --target publish"
|
|
74
76
|
}
|
|
75
77
|
}
|
|
@@ -324,9 +324,14 @@ export function asObservableObject(
|
|
|
324
324
|
|
|
325
325
|
if (__DEV__ && !Object.isExtensible(target))
|
|
326
326
|
die("Cannot make the designated object observable; it is not extensible")
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
327
|
+
|
|
328
|
+
if (!name) {
|
|
329
|
+
if (isPlainObject(target)) {
|
|
330
|
+
name = "ObservableObject@" + getNextId()
|
|
331
|
+
} else {
|
|
332
|
+
name = (target.constructor.name || "ObservableObject") + "@" + getNextId()
|
|
333
|
+
}
|
|
334
|
+
}
|
|
330
335
|
|
|
331
336
|
const adm = new ObservableObjectAdministration(
|
|
332
337
|
target,
|
package/dist/index.js.flow
DELETED
|
@@ -1,591 +0,0 @@
|
|
|
1
|
-
// @flow
|
|
2
|
-
|
|
3
|
-
export type IObservableMapInitialValues<K, V> = IMapEntries<K, V> | KeyValueMap<V> | IMap<K, V>
|
|
4
|
-
|
|
5
|
-
export interface IMobxConfigurationOptions {
|
|
6
|
-
+enforceActions?: "never" | "always" | "observed";
|
|
7
|
-
computedRequiresReaction?: boolean;
|
|
8
|
-
/**
|
|
9
|
-
* (Experimental)
|
|
10
|
-
* Warn if you try to create to derivation / reactive context without accessing any observable.
|
|
11
|
-
*/
|
|
12
|
-
reactionRequiresObservable?: boolean;
|
|
13
|
-
/**
|
|
14
|
-
* (Experimental)
|
|
15
|
-
* Warn if observables are accessed outside a reactive context
|
|
16
|
-
*/
|
|
17
|
-
observableRequiresReaction?: boolean;
|
|
18
|
-
isolateGlobalState?: boolean;
|
|
19
|
-
disableErrorBoundaries?: boolean;
|
|
20
|
-
reactionScheduler?: (f: () => void) => void;
|
|
21
|
-
useProxies?: "always" | "never" | "ifavailable";
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
declare export function configure(options: IMobxConfigurationOptions): void
|
|
25
|
-
|
|
26
|
-
export interface IAutorunOptions {
|
|
27
|
-
delay?: number;
|
|
28
|
-
name?: string;
|
|
29
|
-
/**
|
|
30
|
-
* warn if the derivation has no dependencies after creation/update
|
|
31
|
-
*/
|
|
32
|
-
requiresObservable?: boolean;
|
|
33
|
-
scheduler?: (callback: () => void) => any;
|
|
34
|
-
onError?: (error: any) => void;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export interface IReactionOptions extends IAutorunOptions {
|
|
38
|
-
fireImmediately?: boolean;
|
|
39
|
-
equals?: IEqualsComparer<any>;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export interface IInterceptable<T> {
|
|
43
|
-
interceptors: IInterceptor<T>[] | any;
|
|
44
|
-
intercept(handler: IInterceptor<T>): Lambda;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export type IEqualsComparer<T> = (a: T, b: T) => boolean
|
|
48
|
-
|
|
49
|
-
export type IInterceptor<T> = (change: T) => T
|
|
50
|
-
|
|
51
|
-
export type IMapEntry<K, V> = [K, V]
|
|
52
|
-
|
|
53
|
-
export type IMapEntries<K, V> = IMapEntry<K, V>[]
|
|
54
|
-
|
|
55
|
-
export interface IMap<K, V> {
|
|
56
|
-
clear(): void;
|
|
57
|
-
delete(key: K): boolean;
|
|
58
|
-
forEach(callbackfn: (value: V, index: K, map: IMap<K, V>) => void, thisArg?: any): void;
|
|
59
|
-
get(key: K): V | any;
|
|
60
|
-
has(key: K): boolean;
|
|
61
|
-
set(key: K, value?: V): any;
|
|
62
|
-
size: number;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
declare export function isObservableMap(x: any): boolean
|
|
66
|
-
|
|
67
|
-
export interface IComputedValueOptions<T> {
|
|
68
|
-
get?: () => T;
|
|
69
|
-
set?: (value: T) => void;
|
|
70
|
-
name?: string;
|
|
71
|
-
equals?: IEqualsComparer<T>;
|
|
72
|
-
context?: any;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
type PropertyDescriptor<T> = {
|
|
76
|
-
enumerable?: boolean,
|
|
77
|
-
configurable?: boolean,
|
|
78
|
-
writable?: boolean,
|
|
79
|
-
value?: T,
|
|
80
|
-
get?: () => T,
|
|
81
|
-
set?: (value: T) => void
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
export interface IComputed {
|
|
85
|
-
<T>(func: () => T, setter?: (value: T) => void): IComputedValue<T>;
|
|
86
|
-
<T>(func: () => T, options: IComputedValueOptions<T>): IComputedValue<T>;
|
|
87
|
-
(target: Object, key: string, baseDescriptor?: PropertyDescriptor<*>): void;
|
|
88
|
-
struct(target: Object, key: string, baseDescriptor?: PropertyDescriptor<*>): void;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
export interface IDependencyTree {
|
|
92
|
-
name: string;
|
|
93
|
-
dependencies?: IDependencyTree[];
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
export interface IObserverTree {
|
|
97
|
-
name: string;
|
|
98
|
-
observers?: IObserverTree[];
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
export interface IAtom {
|
|
102
|
-
reportObserved: () => void;
|
|
103
|
-
reportChanged: () => void;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
export interface IComputedValue<T> {
|
|
107
|
-
get(): T;
|
|
108
|
-
set(value: T): void;
|
|
109
|
-
observe(listener: (newValue: T, oldValue: T) => void, fireImmediately?: boolean): Lambda;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
export interface IObservable {}
|
|
113
|
-
|
|
114
|
-
export interface IDepTreeNode {
|
|
115
|
-
name: string;
|
|
116
|
-
observing?: IObservable[];
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
export interface IDerivation {
|
|
120
|
-
name: string;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
export interface IReactionPublic {
|
|
124
|
-
dispose: () => void;
|
|
125
|
-
trace: (enterBreakPoint?: boolean) => void;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
declare export class IListenable {
|
|
129
|
-
observe(handler: (change: any, oldValue?: any) => void, fireImmediately?: boolean): Lambda;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
export interface IObservableArray<T> extends Array<T> {
|
|
133
|
-
spliceWithArray(index: number, deleteCount?: number, newItems?: T[]): T[];
|
|
134
|
-
observe(
|
|
135
|
-
listener: (changeData: IArrayChange<T> | IArraySplice<T>) => void,
|
|
136
|
-
fireImmediately?: boolean
|
|
137
|
-
): Lambda;
|
|
138
|
-
intercept(handler: IInterceptor<IArrayWillChange<T> | IArrayWillSplice<T>>): Lambda;
|
|
139
|
-
intercept(handler: IInterceptor<IArrayChange<T> | IArraySplice<T>>): Lambda; // TODO: remove in 4.0
|
|
140
|
-
intercept<T>(handler: IInterceptor<IArrayChange<T> | IArraySplice<T>>): Lambda; // TODO: remove in 4.0
|
|
141
|
-
clear(): T[];
|
|
142
|
-
peek(): T[];
|
|
143
|
-
replace(newItems: T[]): T[];
|
|
144
|
-
find(
|
|
145
|
-
predicate: (item: T, index: number, array: Array<T>) => mixed,
|
|
146
|
-
thisArg?: any,
|
|
147
|
-
fromIndex?: number
|
|
148
|
-
): T | any;
|
|
149
|
-
findIndex(
|
|
150
|
-
predicate: (item: T, index: number, array: Array<T>) => mixed,
|
|
151
|
-
thisArg?: any,
|
|
152
|
-
fromIndex?: number
|
|
153
|
-
): number;
|
|
154
|
-
remove(value: T): boolean;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
export interface IArrayChange<T> {
|
|
158
|
-
type: "update";
|
|
159
|
-
object: IObservableArray<T>;
|
|
160
|
-
index: number;
|
|
161
|
-
newValue: T;
|
|
162
|
-
oldValue: T;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
export interface IArraySplice<T> {
|
|
166
|
-
type: "splice";
|
|
167
|
-
object: IObservableArray<T>;
|
|
168
|
-
index: number;
|
|
169
|
-
added: T[];
|
|
170
|
-
addedCount: number;
|
|
171
|
-
removed: T[];
|
|
172
|
-
removedCount: number;
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
export interface IArrayWillChange<T> {
|
|
176
|
-
type: "update";
|
|
177
|
-
object: IObservableArray<T>;
|
|
178
|
-
index: number;
|
|
179
|
-
newValue: T;
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
export interface IArrayWillSplice<T> {
|
|
183
|
-
type: "splice";
|
|
184
|
-
object: IObservableArray<T>;
|
|
185
|
-
index: number;
|
|
186
|
-
added: T[];
|
|
187
|
-
removedCount: number;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
export type KeyValueMap<V> = {
|
|
191
|
-
[key: string]: V
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
export interface IMapChange<K, T> {
|
|
195
|
-
object: ObservableMap<K, T>;
|
|
196
|
-
type: "update" | "add" | "delete";
|
|
197
|
-
name: K;
|
|
198
|
-
newValue?: any;
|
|
199
|
-
oldValue?: any;
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
export interface IMapWillChange<K, T> {
|
|
203
|
-
object: ObservableMap<K, T>;
|
|
204
|
-
type: "update" | "add" | "delete";
|
|
205
|
-
name: K;
|
|
206
|
-
newValue?: any;
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
export interface IObservableObject {}
|
|
210
|
-
|
|
211
|
-
export interface IObjectChange {
|
|
212
|
-
name: string;
|
|
213
|
-
object: any;
|
|
214
|
-
type: "update" | "add" | "remove";
|
|
215
|
-
oldValue?: any;
|
|
216
|
-
newValue: any;
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
export interface IObjectWillChange {
|
|
220
|
-
object: any;
|
|
221
|
-
type: "update" | "add" | "remove";
|
|
222
|
-
name: string;
|
|
223
|
-
newValue: any;
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
export interface IValueWillChange<T> {
|
|
227
|
-
object: any;
|
|
228
|
-
type: "update";
|
|
229
|
-
newValue: T;
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
export interface IValueDidChange<T> extends IValueWillChange<T> {
|
|
233
|
-
oldValue: ?T;
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
export interface IObservableValue<T> {
|
|
237
|
-
get(): T;
|
|
238
|
-
set(value: T): void;
|
|
239
|
-
intercept(handler: IInterceptor<IValueWillChange<T>>): Lambda;
|
|
240
|
-
observe(listener: (change: IValueDidChange<T>) => void, fireImmediately?: boolean): Lambda;
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
export interface IEnhancer<T> {
|
|
244
|
-
(newValue: T, oldValue: T | void, name: string): T;
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
export interface IObservableFactory {
|
|
248
|
-
// observable overloads
|
|
249
|
-
(target: Object, key: string, baseDescriptor?: PropertyDescriptor<*>): any;
|
|
250
|
-
<T>(value: Array<T>): IObservableArray<T>;
|
|
251
|
-
<T>(value: null | void): IObservableValue<T>;
|
|
252
|
-
(value: null | void): IObservableValue<any>;
|
|
253
|
-
<T>(value: IMap<string | number | boolean, T>): ObservableMap<T>;
|
|
254
|
-
<T: Object>(value: T): T;
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
export type IObservableDecorator = {
|
|
258
|
-
(target: Object, property: string, descriptor?: PropertyDescriptor<*>): void,
|
|
259
|
-
enhancer: IEnhancer<any>
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
export type CreateObservableOptions = {
|
|
263
|
-
name?: string,
|
|
264
|
-
deep?: boolean,
|
|
265
|
-
defaultDecorator?: IObservableDecorator
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
declare export class IObservableFactories {
|
|
269
|
-
box<T>(value?: T, options?: CreateObservableOptions): IObservableValue<T>;
|
|
270
|
-
array<T>(initialValues?: T[], options?: CreateObservableOptions): IObservableArray<T>;
|
|
271
|
-
set<V>(initialValues?: V[], options?: CreateObservableOptions): Set<V>;
|
|
272
|
-
map<K, V>(
|
|
273
|
-
initialValues?: IObservableMapInitialValues<K, V>,
|
|
274
|
-
options?: CreateObservableOptions
|
|
275
|
-
): ObservableMap<K, V>;
|
|
276
|
-
object<T>(props: T, options?: CreateObservableOptions): T & IObservableObject;
|
|
277
|
-
ref(
|
|
278
|
-
target: Object,
|
|
279
|
-
property?: string,
|
|
280
|
-
descriptor?: PropertyDescriptor<*>
|
|
281
|
-
): IObservableDecorator;
|
|
282
|
-
shallow(
|
|
283
|
-
target: Object,
|
|
284
|
-
property?: string,
|
|
285
|
-
descriptor?: PropertyDescriptor<*>
|
|
286
|
-
): IObservableDecorator;
|
|
287
|
-
deep(
|
|
288
|
-
target: Object,
|
|
289
|
-
property?: string,
|
|
290
|
-
descriptor?: PropertyDescriptor<*>
|
|
291
|
-
): IObservableDecorator;
|
|
292
|
-
struct(
|
|
293
|
-
target: Object,
|
|
294
|
-
property?: string,
|
|
295
|
-
descriptor?: PropertyDescriptor<*>
|
|
296
|
-
): IObservableDecorator;
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
export interface Lambda {
|
|
300
|
-
(): void;
|
|
301
|
-
name?: string;
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
export interface IActionFactory {
|
|
305
|
-
(a1: any, a2?: any, a3?: any, a4?: any, a6?: any): any;
|
|
306
|
-
bound(target: Object, propertyKey: string, descriptor?: PropertyDescriptor<*>): void;
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
declare export class ObservableMap<K, V> {
|
|
310
|
-
constructor(initialData?: IMapEntries<K, V> | KeyValueMap<V>, valueModeFunc?: Function): this;
|
|
311
|
-
has(key: K): boolean;
|
|
312
|
-
set(key: K, value: V): void;
|
|
313
|
-
delete(key: K): boolean;
|
|
314
|
-
get(key: K): V;
|
|
315
|
-
keys(): Iterator<K>;
|
|
316
|
-
values(): Iterator<V>;
|
|
317
|
-
entries(): IMapEntries<K, V> & Iterator<IMapEntry<K, V>>;
|
|
318
|
-
forEach(callback: (value: V, key: K, object: KeyValueMap<K, V>) => void, thisArg?: any): void;
|
|
319
|
-
merge(other: ObservableMap<K, V> | KeyValueMap<K, V>): ObservableMap<K, V>;
|
|
320
|
-
clear(): void;
|
|
321
|
-
replace(other: ObservableMap<K, V> | KeyValueMap<K, V>): ObservableMap<K, V>;
|
|
322
|
-
size: number;
|
|
323
|
-
toJS(): Map<K, V>;
|
|
324
|
-
toPOJO(): KeyValueMap<V>;
|
|
325
|
-
toJSON(): KeyValueMap<V>;
|
|
326
|
-
toString(): string;
|
|
327
|
-
observe(listener: (changes: IMapChange<K, V>) => void, fireImmediately?: boolean): Lambda;
|
|
328
|
-
intercept(handler: IInterceptor<IMapWillChange<K, V>>): Lambda;
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
declare export function action(
|
|
332
|
-
targetOrName: any,
|
|
333
|
-
propertyKeyOrFuc?: any,
|
|
334
|
-
descriptor?: PropertyDescriptor<*>
|
|
335
|
-
): any
|
|
336
|
-
declare export function action<T>(name: string, func: T): T
|
|
337
|
-
declare export function action<T>(func: T): T
|
|
338
|
-
|
|
339
|
-
declare export function runInAction<T>(name: string, block: () => T): T
|
|
340
|
-
declare export function runInAction<T>(block: () => T): T
|
|
341
|
-
declare export function isAction(thing: any): boolean
|
|
342
|
-
declare export function autorun(
|
|
343
|
-
nameOrFunction: string | ((r: IReactionPublic) => any),
|
|
344
|
-
options?: IAutorunOptions
|
|
345
|
-
): any
|
|
346
|
-
declare export function reaction<T>(
|
|
347
|
-
expression: (r: IReactionPublic) => T,
|
|
348
|
-
effect: (arg: T, r: IReactionPublic) => void,
|
|
349
|
-
opts?: IReactionOptions
|
|
350
|
-
): () => mixed
|
|
351
|
-
|
|
352
|
-
export interface IWhenOptions {
|
|
353
|
-
name?: string;
|
|
354
|
-
timeout?: number;
|
|
355
|
-
onError?: (error: any) => void;
|
|
356
|
-
/**
|
|
357
|
-
* warn if the derivation has no dependencies after creation/update
|
|
358
|
-
*/
|
|
359
|
-
requiresObservable?: boolean;
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
declare export function when(
|
|
363
|
-
cond: () => boolean,
|
|
364
|
-
effect: Lambda,
|
|
365
|
-
options?: IWhenOptions
|
|
366
|
-
): () => mixed
|
|
367
|
-
declare export function when(cond: () => boolean, options?: IWhenOptions): Promise<any>
|
|
368
|
-
|
|
369
|
-
declare export function computed<T>(
|
|
370
|
-
target: any,
|
|
371
|
-
key?: string,
|
|
372
|
-
baseDescriptor?: PropertyDescriptor<*>
|
|
373
|
-
): any
|
|
374
|
-
|
|
375
|
-
declare export function extendObservable<A, B>(
|
|
376
|
-
target: A,
|
|
377
|
-
properties: B,
|
|
378
|
-
decorators?: any,
|
|
379
|
-
options?: any
|
|
380
|
-
): A & B
|
|
381
|
-
|
|
382
|
-
declare export function makeObservable<A>(target: A, annotations?: any, options: any): A
|
|
383
|
-
|
|
384
|
-
declare export function makeAutoObservable<A>(target: A, exceptions?: any, options: any): A
|
|
385
|
-
|
|
386
|
-
declare export function intercept(
|
|
387
|
-
object: Object,
|
|
388
|
-
property: string,
|
|
389
|
-
handler: IInterceptor<any>
|
|
390
|
-
): Lambda
|
|
391
|
-
|
|
392
|
-
declare export function isComputed(value: any): boolean
|
|
393
|
-
declare export function isComputedProp(value: any, property: string): boolean
|
|
394
|
-
|
|
395
|
-
declare export function isObservable(value: any): boolean
|
|
396
|
-
declare export function isObservableProp(value: any, property: string): boolean
|
|
397
|
-
|
|
398
|
-
declare export var comparer: {
|
|
399
|
-
identity: IEqualsComparer<any>,
|
|
400
|
-
structural: IEqualsComparer<any>,
|
|
401
|
-
default: IEqualsComparer<any>
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
declare export var observable: IObservableFactory &
|
|
405
|
-
IObservableFactories & {
|
|
406
|
-
deep: {
|
|
407
|
-
struct<T>(initialValue?: T): T
|
|
408
|
-
},
|
|
409
|
-
ref: {
|
|
410
|
-
struct<T>(initialValue?: T): T
|
|
411
|
-
}
|
|
412
|
-
}
|
|
413
|
-
|
|
414
|
-
declare export function observe<T>(
|
|
415
|
-
value: IObservableValue<T> | IComputedValue<T>,
|
|
416
|
-
listener: (change: IValueDidChange<T>) => void,
|
|
417
|
-
fireImmediately?: boolean
|
|
418
|
-
): Lambda
|
|
419
|
-
declare export function observe<T>(
|
|
420
|
-
observableArray: IObservableArray<T>,
|
|
421
|
-
listener: (change: IArrayChange<T> | IArraySplice<T>) => void,
|
|
422
|
-
fireImmediately?: boolean
|
|
423
|
-
): Lambda
|
|
424
|
-
declare export function observe<K, T>(
|
|
425
|
-
observableMap: ObservableMap<K, T>,
|
|
426
|
-
listener: (change: IMapChange<K, T>) => void,
|
|
427
|
-
fireImmediately?: boolean
|
|
428
|
-
): Lambda
|
|
429
|
-
declare export function observe<K, T>(
|
|
430
|
-
observableMap: ObservableMap<K, T>,
|
|
431
|
-
property: string,
|
|
432
|
-
listener: (change: IValueDidChange<K, T>) => void,
|
|
433
|
-
fireImmediately?: boolean
|
|
434
|
-
): Lambda
|
|
435
|
-
declare export function observe(
|
|
436
|
-
object: any,
|
|
437
|
-
listener: (change: IObjectChange) => void,
|
|
438
|
-
fireImmediately?: boolean
|
|
439
|
-
): Lambda
|
|
440
|
-
declare export function observe(
|
|
441
|
-
object: any,
|
|
442
|
-
property: string,
|
|
443
|
-
listener: (change: IValueDidChange<any>) => void,
|
|
444
|
-
fireImmediately?: boolean
|
|
445
|
-
): Lambda
|
|
446
|
-
|
|
447
|
-
declare export function toJS<T>(source: T): T
|
|
448
|
-
|
|
449
|
-
declare export function untracked<T>(action: () => T): T
|
|
450
|
-
|
|
451
|
-
declare export function spy(listener: (change: any) => void): Lambda
|
|
452
|
-
|
|
453
|
-
declare export function transaction<T>(action: () => T, thisArg?: any, report?: boolean): T
|
|
454
|
-
|
|
455
|
-
declare export function isObservableArray(thing: any): boolean
|
|
456
|
-
|
|
457
|
-
declare export function isObservableObject<T>(thing: T): boolean
|
|
458
|
-
|
|
459
|
-
declare export class Reaction {
|
|
460
|
-
name: string;
|
|
461
|
-
isDisposed: boolean;
|
|
462
|
-
constructor(name: string, onInvalidate: () => void): this;
|
|
463
|
-
schedule(): void;
|
|
464
|
-
isScheduled(): boolean;
|
|
465
|
-
track(fn: () => void): void;
|
|
466
|
-
dispose(): void;
|
|
467
|
-
getDisposer(): Lambda & {
|
|
468
|
-
$mosbservable: Reaction
|
|
469
|
-
};
|
|
470
|
-
toString(): string;
|
|
471
|
-
trace(enterBreakPoint?: boolean): void;
|
|
472
|
-
}
|
|
473
|
-
|
|
474
|
-
declare export function createAtom(
|
|
475
|
-
name: string,
|
|
476
|
-
onBecomeObservedHandler?: () => void,
|
|
477
|
-
onBecomeUnobservedHandler?: () => void
|
|
478
|
-
): IAtom
|
|
479
|
-
|
|
480
|
-
declare export function decorate<T>(target: T, decorators: any): T
|
|
481
|
-
|
|
482
|
-
export type CancellablePromise<T> = Promise<T> & { cancel: () => void }
|
|
483
|
-
|
|
484
|
-
declare export function flow<T>(
|
|
485
|
-
fn: () => Generator<any, T | Promise<T>, any> | AsyncGenerator<any, T | Promise<T>, any>
|
|
486
|
-
): () => CancellablePromise<T>
|
|
487
|
-
declare export function flow<T, A>(
|
|
488
|
-
fn: (A) => Generator<any, T | Promise<T>, any> | AsyncGenerator<any, T | Promise<T>, any>
|
|
489
|
-
): A => CancellablePromise<T>
|
|
490
|
-
declare export function flow<T, A, B>(
|
|
491
|
-
fn: (A, B) => Generator<any, T | Promise<T>, any> | AsyncGenerator<any, T | Promise<T>, any>
|
|
492
|
-
): (A, B) => CancellablePromise<T>
|
|
493
|
-
declare export function flow<T, A, B, C>(
|
|
494
|
-
fn: (A, B, C) => Generator<any, T | Promise<T>, any> | AsyncGenerator<any, T | Promise<T>, any>
|
|
495
|
-
): (A, B, C) => CancellablePromise<T>
|
|
496
|
-
declare export function flow<T, A, B, C, D>(
|
|
497
|
-
fn: (
|
|
498
|
-
A,
|
|
499
|
-
B,
|
|
500
|
-
C,
|
|
501
|
-
D
|
|
502
|
-
) => Generator<any, T | Promise<T>, any> | AsyncGenerator<any, T | Promise<T>, any>
|
|
503
|
-
): (A, B, C, D) => CancellablePromise<T>
|
|
504
|
-
declare export function flow<T, A, B, C, D, E>(
|
|
505
|
-
fn: (
|
|
506
|
-
A,
|
|
507
|
-
B,
|
|
508
|
-
C,
|
|
509
|
-
D,
|
|
510
|
-
E
|
|
511
|
-
) => Generator<any, T | Promise<T>, any> | AsyncGenerator<any, T | Promise<T>, any>
|
|
512
|
-
): (A, B, C, D, E) => CancellablePromise<T>
|
|
513
|
-
declare export function flow<T, A, B, C, D, E, F>(
|
|
514
|
-
fn: (
|
|
515
|
-
A,
|
|
516
|
-
B,
|
|
517
|
-
C,
|
|
518
|
-
D,
|
|
519
|
-
E,
|
|
520
|
-
F
|
|
521
|
-
) => Generator<any, T | Promise<T>, any> | AsyncGenerator<any, T | Promise<T>, any>
|
|
522
|
-
): (A, B, C, D, E, F) => CancellablePromise<T>
|
|
523
|
-
declare export function flow<T, A, B, C, D, E, F, G, H>(
|
|
524
|
-
fn: (
|
|
525
|
-
A,
|
|
526
|
-
B,
|
|
527
|
-
C,
|
|
528
|
-
D,
|
|
529
|
-
E,
|
|
530
|
-
F,
|
|
531
|
-
G,
|
|
532
|
-
H
|
|
533
|
-
) => Generator<any, T | Promise<T>, any> | AsyncGenerator<any, T | Promise<T>, any>
|
|
534
|
-
): (A, B, C, D, E, F, G, H) => CancellablePromise<T>
|
|
535
|
-
|
|
536
|
-
declare export function isFlowCancellationError(error: Error): boolean
|
|
537
|
-
declare export class FlowCancellationError extends Error {}
|
|
538
|
-
|
|
539
|
-
declare export function keys<K>(map: ObservableMap<K, any>): K[]
|
|
540
|
-
declare export function keys(obj: any): string[]
|
|
541
|
-
|
|
542
|
-
declare export function values<K, T>(map: ObservableMap<K, T>): T[]
|
|
543
|
-
declare export function values<T>(ar: IObservableArray<T>): T[]
|
|
544
|
-
declare export function values(obj: any): any[]
|
|
545
|
-
|
|
546
|
-
declare export function set<V>(obj: ObservableMap<string, V>, values: { [key: string]: V }): void
|
|
547
|
-
declare export function set<K, V>(obj: ObservableMap<K, V>, key: K, value: V): void
|
|
548
|
-
declare export function set<T>(obj: IObservableArray<T>, index: number, value: T): void
|
|
549
|
-
declare export function set(obj: any, values: { [key: string]: any }): void
|
|
550
|
-
declare export function set(obj: any, key: string, value: any): void
|
|
551
|
-
|
|
552
|
-
declare export function remove<K, V>(obj: ObservableMap<K, V>, key: K): void
|
|
553
|
-
declare export function remove<T>(obj: IObservableArray<T>, index: number): void
|
|
554
|
-
declare export function remove(obj: any, key: string): void
|
|
555
|
-
|
|
556
|
-
declare export function has<K>(obj: ObservableMap<K, any>, key: K): boolean
|
|
557
|
-
declare export function has<T>(obj: IObservableArray<T>, index: number): boolean
|
|
558
|
-
declare export function has(obj: any, key: string): boolean
|
|
559
|
-
|
|
560
|
-
declare export function get<K, V>(obj: ObservableMap<K, V>, key: K): V | void
|
|
561
|
-
declare export function get<T>(obj: IObservableArray<T>, index: number): T | void
|
|
562
|
-
declare export function get(obj: any, key: string): any
|
|
563
|
-
|
|
564
|
-
declare export function onReactionError(
|
|
565
|
-
handler: (error: any, derivation: IDerivation) => void
|
|
566
|
-
): () => void
|
|
567
|
-
|
|
568
|
-
declare export function onBecomeObserved(
|
|
569
|
-
value: IObservable | IComputedValue<any> | IObservableArray<any> | ObservableMap<any, any>,
|
|
570
|
-
listener: Lambda
|
|
571
|
-
): Lambda
|
|
572
|
-
declare export function onBecomeObserved<K>(
|
|
573
|
-
value: ObservableMap<K, any> | Object,
|
|
574
|
-
property: K,
|
|
575
|
-
listener: Lambda
|
|
576
|
-
): Lambda
|
|
577
|
-
|
|
578
|
-
declare export function onBecomeUnobserved(
|
|
579
|
-
value: IObservable | IComputedValue<any> | IObservableArray<any> | ObservableMap<any, any>,
|
|
580
|
-
listener: Lambda
|
|
581
|
-
): Lambda
|
|
582
|
-
declare export function onBecomeUnobserved<K>(
|
|
583
|
-
value: ObservableMap<K, any> | Object,
|
|
584
|
-
property: K,
|
|
585
|
-
listener: Lambda
|
|
586
|
-
): Lambda
|
|
587
|
-
|
|
588
|
-
declare export function getAtom(thing: any, property?: string): IDepTreeNode
|
|
589
|
-
declare export function getDebugName(thing: any, property?: string): string
|
|
590
|
-
declare export function getDependencyTree(thing: any, property?: string): IDependencyTree
|
|
591
|
-
declare export function getObserverTree(thing: any, property?: string): IObserverTree
|