mobx 5.9.4-special → 5.9.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 +1 -3
- package/README.md +84 -85
- package/lib/api/object-api.d.ts +0 -1
- package/lib/mobx.es6.js +2 -5
- package/lib/mobx.js +2 -5
- package/lib/mobx.min.js +1 -1
- package/lib/mobx.min.js.map +1 -1
- package/lib/mobx.module.js +2 -5
- package/lib/mobx.umd.js +2 -5
- package/lib/mobx.umd.min.js +1 -1
- package/lib/mobx.umd.min.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
* Added `set` support for `observable.set`, see [#1945](https://github.com/mobxjs/mobx/pull/1945) by [xaviergonz](https://github.com/xaviergonz)
|
|
2
|
-
|
|
3
1
|
# 5.9.4 / 4.9.4
|
|
4
2
|
|
|
5
3
|
* Allow symbol keys in `ObservableMap`, see [#1930](https://github.com/mobxjs/mobx/pull/1930) by [pimterry](https://github.com/pimterry)
|
|
6
|
-
* Fixed type definitions of `toStringTag` for Maps and Sets, see [#1929](https://github.com/mobxjs/mobx/pull/1929) by [lennerd](https://github.com/
|
|
4
|
+
* Fixed type definitions of `toStringTag` for Maps and Sets, see [#1929](https://github.com/mobxjs/mobx/pull/1929) by [lennerd](https://github.com/mobxjs/mobx/pull/1929)
|
|
7
5
|
|
|
8
6
|
# 4.9.3
|
|
9
7
|
|
package/README.md
CHANGED
|
@@ -24,48 +24,49 @@ MobX is proudly sponsored by Mendix, Coinbase, Facebook Open Source, Canva, Algo
|
|
|
24
24
|
<a href="https://mantro.net/jobs/warlock"><img src="docs/mantro.png" align="center" width="100" title="mantro GmbH" alt="mantro GmbH"></a>
|
|
25
25
|
<a href="https://talentplot.com/"><img src="docs/talentplot.png" align="center" width="100" title="talentplot" alt="talentplot"></a>
|
|
26
26
|
<a href="https://www.codefirst.co.uk/"><img src="https://mobx.js.org/docs/codefirst.png" align="center" width="100" title="CodeFirst" alt="CodeFirst"/></a>
|
|
27
|
-
<a href="https://blokt.com/"><img src="https://mobx.js.org/docs/blokt.jpg" align="center" width="100" title="Blokt" alt="Blokt"/></a>
|
|
28
|
-
<a href="https://www.faire.com/"><img src="https://mobx.js.org/docs/faire.jpg" align="center" width="100" title="Faire" alt="Faire"/></a>
|
|
29
27
|
|
|
30
28
|
# Installation
|
|
31
29
|
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
|
|
35
|
-
|
|
30
|
+
* Installation: `npm install mobx --save`. React bindings: `npm install mobx-react --save`. To enable ESNext decorators (optional), see below.
|
|
31
|
+
* CDN:
|
|
32
|
+
* https://unpkg.com/mobx/lib/mobx.umd.js
|
|
33
|
+
* https://cdnjs.com/libraries/mobx
|
|
34
|
+
|
|
36
35
|
|
|
37
36
|
_Tip: Consider using the faster and smaller ES6 build if targetting a modern environment: `lib/mobx.es6.js`. For example by setting up a webpack alias: `resolve: { alias: { mobx: __dirname + "/node_modules/mobx/lib/mobx.es6.js" }}`_
|
|
38
37
|
|
|
39
38
|
# Browser support
|
|
40
39
|
|
|
41
|
-
| MobX version | Actively supported
|
|
42
|
-
|
|
|
43
|
-
| 5
|
|
44
|
-
| 4
|
|
45
|
-
| 1-3
|
|
40
|
+
| MobX version | Actively supported | Supported browsers | GitHub branch |
|
|
41
|
+
| ----- | ----- | --- | --- |
|
|
42
|
+
| 5.* | Yes | Any browser that supports [ES6 Proxies](https://kangax.github.io/compat-table/es6/#test-Proxy) (non polyfillable). _NOT:_ IE 11 and lower, Node 5 and lower, Google's crawler bot | `master` |
|
|
43
|
+
| 4.* | Yes (LTS) | Any ES5 compliant browser | `mobx4-master` |
|
|
44
|
+
| 1-3.* | No | Any ES5 compliant browser | No active branch |
|
|
45
|
+
|
|
46
|
+
* MobX >=5 runs on any browser with [ES6 proxy support](https://kangax.github.io/compat-table/es6/#test-Proxy). It will throw an error on startup on older environments such as IE11, Node.js <6 or React Native Android on old JavaScriptCore [how-to-upgrade](https://github.com/react-community/jsc-android-buildscripts#how-to-use-it-with-my-react-native-app). _Warning: since upgrading JSC is non-trivial, and decorators can be [troublesome](https://github.com/mobxjs/mobx/issues/1777) as well in React Native, for now it is recommended to stick to MobX 4.x for React Native Android development_.
|
|
47
|
+
* MobX 4 runs on any ES5 browser and will be actively maintained. The MobX 4 and 5 api's are the same and semantically can achieve the same, but MobX 4 has some [limitations](#mobx-4-vs-mobx-5).
|
|
46
48
|
|
|
47
|
-
* MobX >=5 runs on any browser with [ES6 proxy support](https://kangax.github.io/compat-table/es6/#test-Proxy). It will throw an error on startup on older environments such as IE11, Node.js <6 or React Native Android on old JavaScriptCore [how-to-upgrade](https://github.com/react-community/jsc-android-buildscripts#how-to-use-it-with-my-react-native-app).
|
|
48
|
-
* MobX 4 runs on any ES5 browser and will be actively maintained. The MobX 4 and 5 api's are the same and semantically can achieve the same, but MobX 4 has some [limitations](#mobx-4-vs-mobx-5).
|
|
49
49
|
|
|
50
50
|
## Translations
|
|
51
51
|
|
|
52
|
-
*
|
|
52
|
+
* [中文](http://cn.mobx.js.org)
|
|
53
53
|
|
|
54
54
|
## Getting started
|
|
55
55
|
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
*
|
|
68
|
-
*
|
|
56
|
+
* <i><a style="color: white; background:green;padding:5px;margin:5px;border-radius:2px" href="https://egghead.io/courses/manage-complex-state-in-react-apps-with-mobx">Egghead.io course</a></i>
|
|
57
|
+
* [Ten minute, interactive MobX + React tutorial](https://mobxjs.github.io/mobx/getting-started.html)
|
|
58
|
+
* <img src="docs/book.jpg" height="80px"/> [The MobX book](https://books.google.nl/books?id=ALFmDwAAQBAJ&pg=PP1&lpg=PP1&dq=michel+weststrate+mobx+quick+start+guide:+supercharge+the+client+state+in+your+react+apps+with+mobx&source=bl&ots=D460fxti0F&sig=ivDGTxsPNwlOjLHrpKF1nweZFl8&hl=nl&sa=X&ved=2ahUKEwiwl8XO--ncAhWPmbQKHWOYBqIQ6AEwAnoECAkQAQ#v=onepage&q=michel%20weststrate%20mobx%20quick%20start%20guide%3A%20supercharge%20the%20client%20state%20in%20your%20react%20apps%20with%20mobx&f=false) by Pavan Podila and Michel Weststrate (which despite it's name is in-depth!)
|
|
59
|
+
* [Official MobX 4 documentation and API overview](https://mobxjs.github.io/mobx/refguide/api.html) ([MobX 3](https://github.com/mobxjs/mobx/blob/54557dc319b04e92e31cb87427bef194ec1c549c/docs/refguide/api.md), [MobX 2](https://github.com/mobxjs/mobx/blob/7c9e7c86e0c6ead141bb0539d33143d0e1f576dd/docs/refguide/api.md))
|
|
60
|
+
* [How to (not) use decorators](https://mobx.js.org/best/decorators.html)
|
|
61
|
+
* Videos:
|
|
62
|
+
* [ReactNext 2016: Real World MobX](https://www.youtube.com/watch?v=Aws40KOx90U) - 40m [slides](https://docs.google.com/presentation/d/1DrI6Hc2xIPTLBkfNH8YczOcPXQTOaCIcDESdyVfG_bE/edit?usp=sharing)
|
|
63
|
+
* [Practical React with MobX](https://www.youtube.com/watch?v=XGwuM_u7UeQ). In depth introduction and explanation to MobX and React by Matt Ruby on OpenSourceNorth (ES5 only) - 42m.
|
|
64
|
+
* LearnCode.academy MobX tutorial [Part I: MobX + React is AWESOME (7m)](https://www.youtube.com/watch?v=_q50BXqkAfI) [Part II: Computed Values and Nested/Referenced Observables (12m.)](https://www.youtube.com/watch?v=nYvNqKrl69s)
|
|
65
|
+
* [Screencast: intro to MobX](https://www.youtube.com/watch?v=K8dr8BMU7-8) - 8m
|
|
66
|
+
* [Talk: State Management Is Easy, React Amsterdam 2016 conf](https://www.youtube.com/watch?v=ApmSsu3qnf0&feature=youtu.be) ([slides](https://speakerdeck.com/mweststrate/state-management-is-easy-introduction-to-mobx))
|
|
67
|
+
* [Boilerplates and related projects](http://mobxjs.github.io/mobx/faq/boilerplates.html)
|
|
68
|
+
* More tutorials, blogs, videos, and other helpful resources can be found on the [MobX awesome list](https://github.com/mobxjs/awesome-mobx#awesome-mobx)
|
|
69
|
+
|
|
69
70
|
|
|
70
71
|
## Introduction
|
|
71
72
|
|
|
@@ -93,12 +94,12 @@ MobX adds observable capabilities to existing data structures like objects, arra
|
|
|
93
94
|
This can simply be done by annotating your class properties with the [@observable](http://mobxjs.github.io/mobx/refguide/observable-decorator.html) decorator (ES.Next).
|
|
94
95
|
|
|
95
96
|
```javascript
|
|
96
|
-
import { observable } from
|
|
97
|
+
import { observable } from 'mobx';
|
|
97
98
|
|
|
98
99
|
class Todo {
|
|
99
|
-
id = Math.random()
|
|
100
|
-
@observable title =
|
|
101
|
-
@observable finished = false
|
|
100
|
+
id = Math.random();
|
|
101
|
+
@observable title = '';
|
|
102
|
+
@observable finished = false;
|
|
102
103
|
}
|
|
103
104
|
```
|
|
104
105
|
|
|
@@ -111,12 +112,12 @@ Or you can skip them altoghether, as MobX can be used fine without decorator _sy
|
|
|
111
112
|
Many MobX users prefer the slightly more concise decorator syntax, but the following snippet achieves the same:
|
|
112
113
|
|
|
113
114
|
```javascript
|
|
114
|
-
import { decorate, observable } from
|
|
115
|
+
import { decorate, observable } from 'mobx';
|
|
115
116
|
|
|
116
117
|
class Todo {
|
|
117
|
-
id = Math.random()
|
|
118
|
-
title =
|
|
119
|
-
finished = false
|
|
118
|
+
id = Math.random();
|
|
119
|
+
title = '';
|
|
120
|
+
finished = false;
|
|
120
121
|
}
|
|
121
122
|
decorate(Todo, {
|
|
122
123
|
title: observable,
|
|
@@ -133,10 +134,9 @@ By using the [`@computed`](http://mobxjs.github.io/mobx/refguide/computed-decora
|
|
|
133
134
|
|
|
134
135
|
```javascript
|
|
135
136
|
class TodoList {
|
|
136
|
-
@observable todos = []
|
|
137
|
-
@computed
|
|
138
|
-
|
|
139
|
-
return this.todos.filter(todo => !todo.finished).length
|
|
137
|
+
@observable todos = [];
|
|
138
|
+
@computed get unfinishedTodoCount() {
|
|
139
|
+
return this.todos.filter(todo => !todo.finished).length;
|
|
140
140
|
}
|
|
141
141
|
}
|
|
142
142
|
```
|
|
@@ -158,37 +158,36 @@ In short, reactions bridge [reactive](https://en.wikipedia.org/wiki/Reactive_pro
|
|
|
158
158
|
If you are using React, you can turn your (stateless function) components into reactive components by simply adding the [`observer`](http://mobxjs.github.io/mobx/refguide/observer-component.html) function / decorator from the `mobx-react` package onto them.
|
|
159
159
|
|
|
160
160
|
```javascript
|
|
161
|
-
import React, {
|
|
162
|
-
import ReactDOM from
|
|
163
|
-
import {
|
|
161
|
+
import React, {Component} from 'react';
|
|
162
|
+
import ReactDOM from 'react-dom';
|
|
163
|
+
import {observer} from 'mobx-react';
|
|
164
164
|
|
|
165
165
|
@observer
|
|
166
166
|
class TodoListView extends Component {
|
|
167
167
|
render() {
|
|
168
|
-
return
|
|
169
|
-
<
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
168
|
+
return <div>
|
|
169
|
+
<ul>
|
|
170
|
+
{this.props.todoList.todos.map(todo =>
|
|
171
|
+
<TodoView todo={todo} key={todo.id} />
|
|
172
|
+
)}
|
|
173
|
+
</ul>
|
|
174
|
+
Tasks left: {this.props.todoList.unfinishedTodoCount}
|
|
175
|
+
</div>
|
|
176
176
|
}
|
|
177
177
|
}
|
|
178
178
|
|
|
179
|
-
const TodoView = observer(({
|
|
179
|
+
const TodoView = observer(({todo}) =>
|
|
180
180
|
<li>
|
|
181
181
|
<input
|
|
182
|
-
type=
|
|
182
|
+
type='checkbox'
|
|
183
183
|
checked={todo.finished}
|
|
184
|
-
onClick={() =>
|
|
185
|
-
/>
|
|
186
|
-
{todo.title}
|
|
184
|
+
onClick={() => todo.finished = !todo.finished}
|
|
185
|
+
/>{todo.title}
|
|
187
186
|
</li>
|
|
188
|
-
)
|
|
187
|
+
)
|
|
189
188
|
|
|
190
|
-
const store = new TodoList()
|
|
191
|
-
ReactDOM.render(<TodoListView todoList={store} />, document.getElementById(
|
|
189
|
+
const store = new TodoList();
|
|
190
|
+
ReactDOM.render(<TodoListView todoList={store} />, document.getElementById('mount'));
|
|
192
191
|
```
|
|
193
192
|
|
|
194
193
|
`observer` turns React (function) components into derivations of the data they render.
|
|
@@ -197,7 +196,6 @@ All components render smartly but are defined in a dumb manner. MobX will simply
|
|
|
197
196
|
However, if you would remove the `Tasks left` line (or put it into a separate component), the `TodoListView` will no longer re-render when ticking a box. You can verify this yourself by changing the [JSFiddle](https://jsfiddle.net/mweststrate/wv3yopo0/).
|
|
198
197
|
|
|
199
198
|
#### Custom reactions
|
|
200
|
-
|
|
201
199
|
Custom reactions can simply be created using the [`autorun`](http://mobxjs.github.io/mobx/refguide/autorun.html),
|
|
202
200
|
[`reaction`](http://mobxjs.github.io/mobx/refguide/reaction.html) or [`when`](http://mobxjs.github.io/mobx/refguide/when.html) functions to fit your specific situations.
|
|
203
201
|
|
|
@@ -205,7 +203,7 @@ For example the following `autorun` prints a log message each time the amount of
|
|
|
205
203
|
|
|
206
204
|
```javascript
|
|
207
205
|
autorun(() => {
|
|
208
|
-
console.log(`Tasks left: ${todos.unfinishedTodoCount}`)
|
|
206
|
+
console.log(`Tasks left: ${ todos.unfinishedTodoCount }`)
|
|
209
207
|
})
|
|
210
208
|
```
|
|
211
209
|
|
|
@@ -223,9 +221,9 @@ For an in-depth explanation about how MobX determines to which observables needs
|
|
|
223
221
|
|
|
224
222
|
Unlike many flux frameworks, MobX is unopinionated about how user events should be handled.
|
|
225
223
|
|
|
226
|
-
*
|
|
227
|
-
*
|
|
228
|
-
*
|
|
224
|
+
* This can be done in a Flux like manner.
|
|
225
|
+
* Or by processing events using RxJS.
|
|
226
|
+
* Or by simply handling events in the most straightforward way possible, as demonstrated in the above `onClick` handler.
|
|
229
227
|
|
|
230
228
|
In the end it all boils down to: somehow the state should be updated.
|
|
231
229
|
|
|
@@ -234,8 +232,11 @@ After updating the state `MobX` will take care of the rest in an efficient, glit
|
|
|
234
232
|
There is no technical need for firing events, calling a dispatcher, etc. A React component in the end is nothing more than a fancy representation of your state, i.e. a derivation that will be managed by MobX.
|
|
235
233
|
|
|
236
234
|
```javascript
|
|
237
|
-
store.todos.push(
|
|
238
|
-
|
|
235
|
+
store.todos.push(
|
|
236
|
+
new Todo('Get Coffee'),
|
|
237
|
+
new Todo('Write simpler code')
|
|
238
|
+
);
|
|
239
|
+
store.todos[0].finished = true;
|
|
239
240
|
```
|
|
240
241
|
|
|
241
242
|
Nonetheless, MobX has an optional built-in concept of [`actions`](https://mobxjs.github.io/mobx/refguide/action.html).
|
|
@@ -294,12 +295,13 @@ And finally, kudos to all the people that believed in, tried, validated and even
|
|
|
294
295
|
|
|
295
296
|
## Further resources and documentation
|
|
296
297
|
|
|
297
|
-
*
|
|
298
|
-
*
|
|
299
|
-
*
|
|
300
|
-
*
|
|
301
|
-
*
|
|
302
|
-
*
|
|
298
|
+
* <img src="docs/book.jpg" height="80px"/> [The MobX book](https://books.google.nl/books?id=ALFmDwAAQBAJ&pg=PP1&lpg=PP1&dq=michel+weststrate+mobx+quick+start+guide:+supercharge+the+client+state+in+your+react+apps+with+mobx&source=bl&ots=D460fxti0F&sig=ivDGTxsPNwlOjLHrpKF1nweZFl8&hl=nl&sa=X&ved=2ahUKEwiwl8XO--ncAhWPmbQKHWOYBqIQ6AEwAnoECAkQAQ#v=onepage&q=michel%20weststrate%20mobx%20quick%20start%20guide%3A%20supercharge%20the%20client%20state%20in%20your%20react%20apps%20with%20mobx&f=false) by Pavan Podila and Michel Weststrate (which despite it's name is in-depth!)
|
|
299
|
+
* [MobX homepage](http://mobxjs.github.io/mobx/faq/blogs.html)
|
|
300
|
+
* [API overview](http://mobxjs.github.io/mobx/refguide/api.html)
|
|
301
|
+
* [Tutorials, Blogs & Videos](http://mobxjs.github.io/mobx/faq/blogs.html)
|
|
302
|
+
* [Boilerplates](http://mobxjs.github.io/mobx/faq/boilerplates.html)
|
|
303
|
+
* [Related projects](http://mobxjs.github.io/mobx/faq/related.html)
|
|
304
|
+
|
|
303
305
|
|
|
304
306
|
## What others are saying...
|
|
305
307
|
|
|
@@ -315,36 +317,34 @@ And finally, kudos to all the people that believed in, tried, validated and even
|
|
|
315
317
|
|
|
316
318
|
> The #mobx is the way I always want things to be! It's really surprising simple and fast! Totally awesome! Don't miss it!
|
|
317
319
|
|
|
318
|
-
> I've been using MobX for over 2 years now, and it
|
|
320
|
+
> I've been using MobX for over 2 years now, and it *still* feels like cheating! 😎
|
|
319
321
|
|
|
320
322
|
## Contributing
|
|
321
323
|
|
|
322
|
-
*
|
|
323
|
-
*
|
|
324
|
-
*
|
|
325
|
-
*
|
|
326
|
-
*
|
|
324
|
+
* Feel free to send small pull requests. Please discuss new features or big changes in a GitHub issue first.
|
|
325
|
+
* Use `yarn test` to run the basic test suite.
|
|
326
|
+
* Use `yarn test:travis` for the test suite with coverage.
|
|
327
|
+
* and `yarn test:performance` for the performance tests.
|
|
328
|
+
* Please note that if you want to backport a feature / fix to MobX 4 a second PR needs to be opened to the mobx4-master branch.
|
|
327
329
|
|
|
328
330
|
# MobX 4 vs MobX 5
|
|
329
331
|
|
|
330
332
|
The difference between MobX 4 and MobX 5 is that the latter uses Proxies to do property tracking. As a consequence, MobX 5 runs only on Proxy supporting browsers, in contrast to MobX 4 that runs on any ES 5 environment.
|
|
331
333
|
|
|
332
334
|
The most noteable limitations of MobX 4:
|
|
333
|
-
|
|
334
|
-
*
|
|
335
|
-
* Adding properties to existing observable objects after creation is not automatically picked up. Instead, either use observable maps or use the the built-in [utility functions](https://mobx.js.org/refguide/object-api.html) to read / write / iterate objects that you want to dynamically add properties to.
|
|
335
|
+
* Observable arrays are not real arrays, so they won't pass the `Array.isArray()` check. The practical consequence is that you often need to `.slice()` the array first (to get a real array shallow copy) before passing to third party libraries.
|
|
336
|
+
* Adding properties to existing observable objects after creation is not automatically picked up. Instead, either use observable maps or use the the built-in [utility functions](https://mobx.js.org/refguide/object-api.html) to read / write / iterate objects that you want to dynamically add properties to.
|
|
336
337
|
|
|
337
338
|
For more details see the [caveats page](https://mobx.js.org/best/pitfalls.html).
|
|
338
339
|
|
|
339
340
|
## Flow support
|
|
340
|
-
|
|
341
341
|
MobX ships with [flow typings](flow-typed/mobx.js). Flow will automatically include them when you import MobX modules. Although you **do not** need to import the types explicitly, you can still do it like this: `import type { ... } from 'mobx'`.
|
|
342
342
|
|
|
343
343
|
To use the [flow typings](flow-typed/mobx.js) shipped with MobX:
|
|
344
344
|
|
|
345
|
-
*
|
|
346
|
-
*
|
|
347
|
-
*
|
|
345
|
+
* In `.flowconfig`, you **cannot** ignore `node_modules`.
|
|
346
|
+
* In `.flowconfig`, you **cannot** import it explicitly in the `[libs]` section.
|
|
347
|
+
* You **do not** need to install library definition using [flow-typed](https://github.com/flowtype/flow-typed).
|
|
348
348
|
|
|
349
349
|
## Donating
|
|
350
350
|
|
|
@@ -352,7 +352,6 @@ Was MobX key in making your project a success?
|
|
|
352
352
|
Join our [open collective](https://opencollective.com/mobx#) or use the [donate button](https://mobxjs.github.io/mobx/donate.html)!
|
|
353
353
|
|
|
354
354
|
### Backers
|
|
355
|
-
|
|
356
355
|
Support us with a monthly donation and help us continue our activities. [[Become a backer](https://opencollective.com/mobx#backer)]
|
|
357
356
|
|
|
358
357
|
<a href="https://opencollective.com/mobx/backer/0/website" target="_blank"><img src="https://opencollective.com/mobx/backer/0/avatar.svg"></a>
|
package/lib/api/object-api.d.ts
CHANGED
|
@@ -15,7 +15,6 @@ export declare function set<V>(obj: ObservableMap<string, V>, values: {
|
|
|
15
15
|
[key: string]: V;
|
|
16
16
|
}): any;
|
|
17
17
|
export declare function set<K, V>(obj: ObservableMap<K, V>, key: K, value: V): any;
|
|
18
|
-
export declare function set<T>(obj: ObservableSet<T>, value: T): any;
|
|
19
18
|
export declare function set<T>(obj: IObservableArray<T>, index: number, value: T): any;
|
|
20
19
|
export declare function set<T extends Object>(obj: T, values: {
|
|
21
20
|
[key: string]: any;
|
package/lib/mobx.es6.js
CHANGED
|
@@ -1574,7 +1574,7 @@ class Reaction$$1 {
|
|
|
1574
1574
|
}
|
|
1575
1575
|
track(fn) {
|
|
1576
1576
|
if (this.isDisposed) {
|
|
1577
|
-
|
|
1577
|
+
fail$$1("Reaction already disposed");
|
|
1578
1578
|
}
|
|
1579
1579
|
startBatch$$1();
|
|
1580
1580
|
const notify = isSpyEnabled$$1();
|
|
@@ -2345,7 +2345,7 @@ function entries$$1(obj) {
|
|
|
2345
2345
|
"'entries()' can only be used on observable objects, arrays and maps");
|
|
2346
2346
|
}
|
|
2347
2347
|
function set$$1(obj, key, value) {
|
|
2348
|
-
if (arguments.length === 2
|
|
2348
|
+
if (arguments.length === 2) {
|
|
2349
2349
|
startBatch$$1();
|
|
2350
2350
|
const values$$1 = key;
|
|
2351
2351
|
try {
|
|
@@ -2370,9 +2370,6 @@ function set$$1(obj, key, value) {
|
|
|
2370
2370
|
else if (isObservableMap$$1(obj)) {
|
|
2371
2371
|
obj.set(key, value);
|
|
2372
2372
|
}
|
|
2373
|
-
else if (isObservableSet$$1(obj)) {
|
|
2374
|
-
obj.add(key);
|
|
2375
|
-
}
|
|
2376
2373
|
else if (isObservableArray$$1(obj)) {
|
|
2377
2374
|
if (typeof key !== "number")
|
|
2378
2375
|
key = parseInt(key, 10);
|
package/lib/mobx.js
CHANGED
|
@@ -1663,7 +1663,7 @@ var Reaction$$1 = /** @class */ (function () {
|
|
|
1663
1663
|
};
|
|
1664
1664
|
Reaction$$1.prototype.track = function (fn) {
|
|
1665
1665
|
if (this.isDisposed) {
|
|
1666
|
-
|
|
1666
|
+
fail$$1("Reaction already disposed");
|
|
1667
1667
|
}
|
|
1668
1668
|
startBatch$$1();
|
|
1669
1669
|
var notify = isSpyEnabled$$1();
|
|
@@ -2442,7 +2442,7 @@ function entries$$1(obj) {
|
|
|
2442
2442
|
"'entries()' can only be used on observable objects, arrays and maps");
|
|
2443
2443
|
}
|
|
2444
2444
|
function set$$1(obj, key, value) {
|
|
2445
|
-
if (arguments.length === 2
|
|
2445
|
+
if (arguments.length === 2) {
|
|
2446
2446
|
startBatch$$1();
|
|
2447
2447
|
var values_1 = key;
|
|
2448
2448
|
try {
|
|
@@ -2467,9 +2467,6 @@ function set$$1(obj, key, value) {
|
|
|
2467
2467
|
else if (isObservableMap$$1(obj)) {
|
|
2468
2468
|
obj.set(key, value);
|
|
2469
2469
|
}
|
|
2470
|
-
else if (isObservableSet$$1(obj)) {
|
|
2471
|
-
obj.add(key);
|
|
2472
|
-
}
|
|
2473
2470
|
else if (isObservableArray$$1(obj)) {
|
|
2474
2471
|
if (typeof key !== "number")
|
|
2475
2472
|
key = parseInt(key, 10);
|