mobx 6.4.2 → 6.6.1
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 +18 -0
- package/README.md +1 -1
- package/dist/api/observable.d.ts +5 -1
- package/dist/mobx.cjs.development.js +15 -15
- 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 +15 -15
- package/dist/mobx.esm.development.js.map +1 -1
- package/dist/mobx.esm.js +15 -15
- 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 +15 -15
- 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/dist/types/observableset.d.ts +2 -2
- package/package.json +1 -1
- package/src/api/observable.ts +8 -3
- package/src/mobx.ts +1 -1
- package/src/types/observableset.ts +2 -2
|
@@ -37,8 +37,8 @@ export declare class ObservableSet<T = any> implements Set<T>, IInterceptable<IS
|
|
|
37
37
|
forEach(callbackFn: (value: T, value2: T, set: Set<T>) => void, thisArg?: any): void;
|
|
38
38
|
get size(): number;
|
|
39
39
|
add(value: T): this;
|
|
40
|
-
delete(value:
|
|
41
|
-
has(value:
|
|
40
|
+
delete(value: T): boolean;
|
|
41
|
+
has(value: T): boolean;
|
|
42
42
|
entries(): IterableIterator<[T, T]>;
|
|
43
43
|
keys(): IterableIterator<T>;
|
|
44
44
|
values(): IterableIterator<T>;
|
package/package.json
CHANGED
package/src/api/observable.ts
CHANGED
|
@@ -136,6 +136,11 @@ function createObservable(v: any, arg2?: any, arg3?: any) {
|
|
|
136
136
|
}
|
|
137
137
|
Object.assign(createObservable, observableDecoratorAnnotation)
|
|
138
138
|
|
|
139
|
+
export interface IObservableValueFactory {
|
|
140
|
+
<T>(value: T, options?: CreateObservableOptions): IObservableValue<T>
|
|
141
|
+
<T>(value?: T, options?: CreateObservableOptions): IObservableValue<T | undefined>
|
|
142
|
+
}
|
|
143
|
+
|
|
139
144
|
export interface IObservableFactory extends Annotation, PropertyDecorator {
|
|
140
145
|
<T = any>(value: T[], options?: CreateObservableOptions): IObservableArray<T>
|
|
141
146
|
<T = any>(value: Set<T>, options?: CreateObservableOptions): ObservableSet<T>
|
|
@@ -146,7 +151,7 @@ export interface IObservableFactory extends Annotation, PropertyDecorator {
|
|
|
146
151
|
options?: CreateObservableOptions
|
|
147
152
|
): T
|
|
148
153
|
|
|
149
|
-
box:
|
|
154
|
+
box: IObservableValueFactory
|
|
150
155
|
array: <T = any>(initialValues?: T[], options?: CreateObservableOptions) => IObservableArray<T>
|
|
151
156
|
set: <T = any>(
|
|
152
157
|
initialValues?: IObservableSetInitialValues<T>,
|
|
@@ -175,7 +180,7 @@ export interface IObservableFactory extends Annotation, PropertyDecorator {
|
|
|
175
180
|
}
|
|
176
181
|
|
|
177
182
|
const observableFactories: IObservableFactory = {
|
|
178
|
-
box<T = any>(value
|
|
183
|
+
box<T = any>(value: T, options?: CreateObservableOptions): IObservableValue<T> {
|
|
179
184
|
const o = asCreateObservableOptions(options)
|
|
180
185
|
return new ObservableValue(value, getEnhancerFromOptions(o), o.name, true, o.equals)
|
|
181
186
|
},
|
|
@@ -201,7 +206,7 @@ const observableFactories: IObservableFactory = {
|
|
|
201
206
|
const o = asCreateObservableOptions(options)
|
|
202
207
|
return new ObservableSet<T>(initialValues, getEnhancerFromOptions(o), o.name)
|
|
203
208
|
},
|
|
204
|
-
object<T = any>(
|
|
209
|
+
object<T extends object = any>(
|
|
205
210
|
props: T,
|
|
206
211
|
decorators?: AnnotationsMap<T, never>,
|
|
207
212
|
options?: CreateObservableOptions
|
package/src/mobx.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* (c) Michel Weststrate 2015 - 2020
|
|
3
3
|
* MIT Licensed
|
|
4
4
|
*
|
|
5
|
-
* Welcome to the mobx sources! To get
|
|
5
|
+
* Welcome to the mobx sources! To get a global overview of how MobX internally works,
|
|
6
6
|
* this is a good place to start:
|
|
7
7
|
* https://medium.com/@mweststrate/becoming-fully-reactive-an-in-depth-explanation-of-mobservable-55995262a254#.xvbh6qd74
|
|
8
8
|
*
|
|
@@ -159,7 +159,7 @@ export class ObservableSet<T = any> implements Set<T>, IInterceptable<ISetWillCh
|
|
|
159
159
|
return this
|
|
160
160
|
}
|
|
161
161
|
|
|
162
|
-
delete(value:
|
|
162
|
+
delete(value: T) {
|
|
163
163
|
if (hasInterceptors(this)) {
|
|
164
164
|
const change = interceptChange<ISetWillChange<T>>(this, {
|
|
165
165
|
type: DELETE,
|
|
@@ -202,7 +202,7 @@ export class ObservableSet<T = any> implements Set<T>, IInterceptable<ISetWillCh
|
|
|
202
202
|
return false
|
|
203
203
|
}
|
|
204
204
|
|
|
205
|
-
has(value:
|
|
205
|
+
has(value: T) {
|
|
206
206
|
this.atom_.reportObserved()
|
|
207
207
|
return this.data_.has(this.dehanceValue_(value))
|
|
208
208
|
}
|