mobx 6.12.5 → 6.13.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 +17 -5
- package/dist/core/atom.d.ts +10 -3
- package/dist/core/computedvalue.d.ts +3 -1
- package/dist/core/observable.d.ts +1 -1
- package/dist/core/reaction.d.ts +16 -6
- package/dist/mobx.cjs.development.js +350 -214
- 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 +350 -214
- package/dist/mobx.esm.development.js.map +1 -1
- package/dist/mobx.esm.js +350 -214
- 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 +350 -214
- 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 +7 -0
- package/dist/utils/utils.d.ts +4 -2
- package/package.json +1 -1
- package/src/api/autorun.ts +4 -4
- package/src/api/when.ts +1 -1
- package/src/core/atom.ts +29 -3
- package/src/core/computedvalue.ts +19 -18
- package/src/core/derivation.ts +6 -6
- package/src/core/observable.ts +1 -1
- package/src/core/reaction.ts +59 -23
- package/src/types/observableset.ts +48 -0
- package/src/utils/utils.ts +13 -0
|
@@ -262,100 +262,88 @@ var getOwnPropertyDescriptors = Object.getOwnPropertyDescriptors || function get
|
|
|
262
262
|
});
|
|
263
263
|
return res;
|
|
264
264
|
};
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
for (var i = 0; i < props.length; i++) {
|
|
268
|
-
var descriptor = props[i];
|
|
269
|
-
descriptor.enumerable = descriptor.enumerable || false;
|
|
270
|
-
descriptor.configurable = true;
|
|
271
|
-
if ("value" in descriptor) descriptor.writable = true;
|
|
272
|
-
Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
function _createClass(Constructor, protoProps, staticProps) {
|
|
276
|
-
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
277
|
-
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
278
|
-
Object.defineProperty(Constructor, "prototype", {
|
|
279
|
-
writable: false
|
|
280
|
-
});
|
|
281
|
-
return Constructor;
|
|
282
|
-
}
|
|
283
|
-
function _extends() {
|
|
284
|
-
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
285
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
286
|
-
var source = arguments[i];
|
|
287
|
-
for (var key in source) {
|
|
288
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
289
|
-
target[key] = source[key];
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
return target;
|
|
294
|
-
};
|
|
295
|
-
return _extends.apply(this, arguments);
|
|
265
|
+
function getFlag(flags, mask) {
|
|
266
|
+
return !!(flags & mask);
|
|
296
267
|
}
|
|
297
|
-
function
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
268
|
+
function setFlag(flags, mask, newValue) {
|
|
269
|
+
if (newValue) {
|
|
270
|
+
flags |= mask;
|
|
271
|
+
} else {
|
|
272
|
+
flags &= ~mask;
|
|
273
|
+
}
|
|
274
|
+
return flags;
|
|
301
275
|
}
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
if (
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
326
|
-
return arr2;
|
|
327
|
-
}
|
|
328
|
-
function _createForOfIteratorHelperLoose(o, allowArrayLike) {
|
|
329
|
-
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
|
330
|
-
if (it) return (it = it.call(o)).next.bind(it);
|
|
331
|
-
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
|
|
332
|
-
if (it) o = it;
|
|
333
|
-
var i = 0;
|
|
276
|
+
|
|
277
|
+
function _arrayLikeToArray(r, a) {
|
|
278
|
+
(null == a || a > r.length) && (a = r.length);
|
|
279
|
+
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
280
|
+
return n;
|
|
281
|
+
}
|
|
282
|
+
function _defineProperties(e, r) {
|
|
283
|
+
for (var t = 0; t < r.length; t++) {
|
|
284
|
+
var o = r[t];
|
|
285
|
+
o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o);
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
function _createClass(e, r, t) {
|
|
289
|
+
return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", {
|
|
290
|
+
writable: !1
|
|
291
|
+
}), e;
|
|
292
|
+
}
|
|
293
|
+
function _createForOfIteratorHelperLoose(r, e) {
|
|
294
|
+
var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
295
|
+
if (t) return (t = t.call(r)).next.bind(t);
|
|
296
|
+
if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) {
|
|
297
|
+
t && (r = t);
|
|
298
|
+
var o = 0;
|
|
334
299
|
return function () {
|
|
335
|
-
|
|
336
|
-
done:
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
value: o[i++]
|
|
300
|
+
return o >= r.length ? {
|
|
301
|
+
done: !0
|
|
302
|
+
} : {
|
|
303
|
+
done: !1,
|
|
304
|
+
value: r[o++]
|
|
341
305
|
};
|
|
342
306
|
};
|
|
343
307
|
}
|
|
344
308
|
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
345
309
|
}
|
|
346
|
-
function
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
310
|
+
function _extends() {
|
|
311
|
+
return _extends = Object.assign ? Object.assign.bind() : function (n) {
|
|
312
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
313
|
+
var t = arguments[e];
|
|
314
|
+
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
315
|
+
}
|
|
316
|
+
return n;
|
|
317
|
+
}, _extends.apply(null, arguments);
|
|
318
|
+
}
|
|
319
|
+
function _inheritsLoose(t, o) {
|
|
320
|
+
t.prototype = Object.create(o.prototype), t.prototype.constructor = t, _setPrototypeOf(t, o);
|
|
321
|
+
}
|
|
322
|
+
function _setPrototypeOf(t, e) {
|
|
323
|
+
return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
|
|
324
|
+
return t.__proto__ = e, t;
|
|
325
|
+
}, _setPrototypeOf(t, e);
|
|
326
|
+
}
|
|
327
|
+
function _toPrimitive(t, r) {
|
|
328
|
+
if ("object" != typeof t || !t) return t;
|
|
329
|
+
var e = t[Symbol.toPrimitive];
|
|
330
|
+
if (void 0 !== e) {
|
|
331
|
+
var i = e.call(t, r || "default");
|
|
332
|
+
if ("object" != typeof i) return i;
|
|
352
333
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
353
334
|
}
|
|
354
|
-
return (
|
|
335
|
+
return ("string" === r ? String : Number)(t);
|
|
355
336
|
}
|
|
356
|
-
function _toPropertyKey(
|
|
357
|
-
var
|
|
358
|
-
return
|
|
337
|
+
function _toPropertyKey(t) {
|
|
338
|
+
var i = _toPrimitive(t, "string");
|
|
339
|
+
return "symbol" == typeof i ? i : i + "";
|
|
340
|
+
}
|
|
341
|
+
function _unsupportedIterableToArray(r, a) {
|
|
342
|
+
if (r) {
|
|
343
|
+
if ("string" == typeof r) return _arrayLikeToArray(r, a);
|
|
344
|
+
var t = {}.toString.call(r).slice(8, -1);
|
|
345
|
+
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
|
|
346
|
+
}
|
|
359
347
|
}
|
|
360
348
|
|
|
361
349
|
var storedAnnotationsSymbol = /*#__PURE__*/Symbol("mobx-stored-annotations");
|
|
@@ -428,8 +416,6 @@ function assert20223DecoratorType(context, types) {
|
|
|
428
416
|
|
|
429
417
|
var $mobx = /*#__PURE__*/Symbol("mobx administration");
|
|
430
418
|
var Atom = /*#__PURE__*/function () {
|
|
431
|
-
// for effective unobserving. BaseAtom has true, for extra optimization, so its onBecomeUnobserved never gets called, because it's not needed
|
|
432
|
-
|
|
433
419
|
/**
|
|
434
420
|
* Create a new atom. For debugging purposes it is recommended to give it a name.
|
|
435
421
|
* The onBecomeObserved and onBecomeUnobserved callbacks can be used for resource management.
|
|
@@ -439,17 +425,17 @@ var Atom = /*#__PURE__*/function () {
|
|
|
439
425
|
name_ = "Atom@" + getNextId() ;
|
|
440
426
|
}
|
|
441
427
|
this.name_ = void 0;
|
|
442
|
-
this.
|
|
443
|
-
this.isBeingObserved = false;
|
|
428
|
+
this.flags_ = 0;
|
|
444
429
|
this.observers_ = new Set();
|
|
445
|
-
this.diffValue_ = 0;
|
|
446
430
|
this.lastAccessedBy_ = 0;
|
|
447
431
|
this.lowestObserverState_ = IDerivationState_.NOT_TRACKING_;
|
|
432
|
+
// onBecomeObservedListeners
|
|
448
433
|
this.onBOL = void 0;
|
|
434
|
+
// onBecomeUnobservedListeners
|
|
449
435
|
this.onBUOL = void 0;
|
|
450
436
|
this.name_ = name_;
|
|
451
437
|
}
|
|
452
|
-
//
|
|
438
|
+
// for effective unobserving. BaseAtom has true, for extra optimization, so its onBecomeUnobserved never gets called, because it's not needed
|
|
453
439
|
var _proto = Atom.prototype;
|
|
454
440
|
_proto.onBO = function onBO() {
|
|
455
441
|
if (this.onBOL) {
|
|
@@ -483,8 +469,35 @@ var Atom = /*#__PURE__*/function () {
|
|
|
483
469
|
_proto.toString = function toString() {
|
|
484
470
|
return this.name_;
|
|
485
471
|
};
|
|
486
|
-
return Atom
|
|
472
|
+
return _createClass(Atom, [{
|
|
473
|
+
key: "isBeingObserved",
|
|
474
|
+
get: function get() {
|
|
475
|
+
return getFlag(this.flags_, Atom.isBeingObservedMask_);
|
|
476
|
+
},
|
|
477
|
+
set: function set(newValue) {
|
|
478
|
+
this.flags_ = setFlag(this.flags_, Atom.isBeingObservedMask_, newValue);
|
|
479
|
+
}
|
|
480
|
+
}, {
|
|
481
|
+
key: "isPendingUnobservation",
|
|
482
|
+
get: function get() {
|
|
483
|
+
return getFlag(this.flags_, Atom.isPendingUnobservationMask_);
|
|
484
|
+
},
|
|
485
|
+
set: function set(newValue) {
|
|
486
|
+
this.flags_ = setFlag(this.flags_, Atom.isPendingUnobservationMask_, newValue);
|
|
487
|
+
}
|
|
488
|
+
}, {
|
|
489
|
+
key: "diffValue",
|
|
490
|
+
get: function get() {
|
|
491
|
+
return getFlag(this.flags_, Atom.diffValueMask_) ? 1 : 0;
|
|
492
|
+
},
|
|
493
|
+
set: function set(newValue) {
|
|
494
|
+
this.flags_ = setFlag(this.flags_, Atom.diffValueMask_, newValue === 1 ? true : false);
|
|
495
|
+
}
|
|
496
|
+
}]);
|
|
487
497
|
}();
|
|
498
|
+
Atom.isBeingObservedMask_ = 1;
|
|
499
|
+
Atom.isPendingUnobservationMask_ = 2;
|
|
500
|
+
Atom.diffValueMask_ = 4;
|
|
488
501
|
var isAtom = /*#__PURE__*/createInstanceofPredicate("Atom", Atom);
|
|
489
502
|
function createAtom(name, onBecomeObservedHandler, onBecomeUnobservedHandler) {
|
|
490
503
|
if (onBecomeObservedHandler === void 0) {
|
|
@@ -631,7 +644,6 @@ function make_(adm, key) {
|
|
|
631
644
|
}
|
|
632
645
|
return 0 /* MakeResult.Cancel */;
|
|
633
646
|
}
|
|
634
|
-
|
|
635
647
|
function extend_(adm, key, descriptor, proxyTrap) {
|
|
636
648
|
die("'" + this.annotationType_ + "' can only be used with 'makeObservable'");
|
|
637
649
|
}
|
|
@@ -664,12 +676,10 @@ function make_$1(adm, key, descriptor, source) {
|
|
|
664
676
|
// rest of the proto chain must be annotated already
|
|
665
677
|
return 1 /* MakeResult.Break */;
|
|
666
678
|
}
|
|
667
|
-
|
|
668
679
|
var actionDescriptor = createActionDescriptor(adm, this, key, descriptor, false);
|
|
669
680
|
defineProperty(source, key, actionDescriptor);
|
|
670
681
|
return 2 /* MakeResult.Continue */;
|
|
671
682
|
}
|
|
672
|
-
|
|
673
683
|
function extend_$1(adm, key, descriptor, proxyTrap) {
|
|
674
684
|
var actionDescriptor = createActionDescriptor(adm, this, key, descriptor);
|
|
675
685
|
return adm.defineProperty_(key, actionDescriptor, proxyTrap);
|
|
@@ -767,18 +777,15 @@ function make_$2(adm, key, descriptor, source) {
|
|
|
767
777
|
return 0 /* MakeResult.Cancel */;
|
|
768
778
|
}
|
|
769
779
|
}
|
|
770
|
-
|
|
771
780
|
if (isFlow(descriptor.value)) {
|
|
772
781
|
// A prototype could have been annotated already by other constructor,
|
|
773
782
|
// rest of the proto chain must be annotated already
|
|
774
783
|
return 1 /* MakeResult.Break */;
|
|
775
784
|
}
|
|
776
|
-
|
|
777
785
|
var flowDescriptor = createFlowDescriptor(adm, this, key, descriptor, false, false);
|
|
778
786
|
defineProperty(source, key, flowDescriptor);
|
|
779
787
|
return 2 /* MakeResult.Continue */;
|
|
780
788
|
}
|
|
781
|
-
|
|
782
789
|
function extend_$2(adm, key, descriptor, proxyTrap) {
|
|
783
790
|
var _this$options_2;
|
|
784
791
|
var flowDescriptor = createFlowDescriptor(adm, this, key, descriptor, (_this$options_2 = this.options_) == null ? void 0 : _this$options_2.bound);
|
|
@@ -855,7 +862,6 @@ function createComputedAnnotation(name, options) {
|
|
|
855
862
|
function make_$3(adm, key, descriptor) {
|
|
856
863
|
return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 1 /* MakeResult.Break */;
|
|
857
864
|
}
|
|
858
|
-
|
|
859
865
|
function extend_$3(adm, key, descriptor, proxyTrap) {
|
|
860
866
|
assertComputedDescriptor(adm, this, key, descriptor);
|
|
861
867
|
return adm.defineComputedProperty_(key, _extends({}, this.options_, {
|
|
@@ -903,7 +909,6 @@ function createObservableAnnotation(name, options) {
|
|
|
903
909
|
function make_$4(adm, key, descriptor) {
|
|
904
910
|
return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 1 /* MakeResult.Break */;
|
|
905
911
|
}
|
|
906
|
-
|
|
907
912
|
function extend_$4(adm, key, descriptor, proxyTrap) {
|
|
908
913
|
var _this$options_$enhanc, _this$options_;
|
|
909
914
|
assertObservableDescriptor(adm, this, key, descriptor);
|
|
@@ -1323,11 +1328,8 @@ function allowStateChangesEnd(prev) {
|
|
|
1323
1328
|
globalState.allowStateChanges = prev;
|
|
1324
1329
|
}
|
|
1325
1330
|
|
|
1326
|
-
var _Symbol$toPrimitive;
|
|
1327
1331
|
var CREATE = "create";
|
|
1328
|
-
_Symbol$toPrimitive = Symbol.toPrimitive;
|
|
1329
1332
|
var ObservableValue = /*#__PURE__*/function (_Atom) {
|
|
1330
|
-
_inheritsLoose(ObservableValue, _Atom);
|
|
1331
1333
|
function ObservableValue(value, enhancer, name_, notifySpy, equals) {
|
|
1332
1334
|
var _this;
|
|
1333
1335
|
if (name_ === void 0) {
|
|
@@ -1356,7 +1358,7 @@ var ObservableValue = /*#__PURE__*/function (_Atom) {
|
|
|
1356
1358
|
// only notify spy if this is a stand-alone observable
|
|
1357
1359
|
spyReport({
|
|
1358
1360
|
type: CREATE,
|
|
1359
|
-
object:
|
|
1361
|
+
object: _this,
|
|
1360
1362
|
observableKind: "value",
|
|
1361
1363
|
debugObjectName: _this.name_,
|
|
1362
1364
|
newValue: "" + _this.value_
|
|
@@ -1364,6 +1366,7 @@ var ObservableValue = /*#__PURE__*/function (_Atom) {
|
|
|
1364
1366
|
}
|
|
1365
1367
|
return _this;
|
|
1366
1368
|
}
|
|
1369
|
+
_inheritsLoose(ObservableValue, _Atom);
|
|
1367
1370
|
var _proto = ObservableValue.prototype;
|
|
1368
1371
|
_proto.dehanceValue = function dehanceValue(value) {
|
|
1369
1372
|
if (this.dehancer !== undefined) {
|
|
@@ -1455,25 +1458,13 @@ var ObservableValue = /*#__PURE__*/function (_Atom) {
|
|
|
1455
1458
|
_proto.valueOf = function valueOf() {
|
|
1456
1459
|
return toPrimitive(this.get());
|
|
1457
1460
|
};
|
|
1458
|
-
_proto[
|
|
1461
|
+
_proto[Symbol.toPrimitive] = function () {
|
|
1459
1462
|
return this.valueOf();
|
|
1460
1463
|
};
|
|
1461
1464
|
return ObservableValue;
|
|
1462
1465
|
}(Atom);
|
|
1463
1466
|
var isObservableValue = /*#__PURE__*/createInstanceofPredicate("ObservableValue", ObservableValue);
|
|
1464
1467
|
|
|
1465
|
-
var _Symbol$toPrimitive$1;
|
|
1466
|
-
function getFlag(flags, mask) {
|
|
1467
|
-
return !!(flags & mask);
|
|
1468
|
-
}
|
|
1469
|
-
function setFlag(flags, mask, newValue) {
|
|
1470
|
-
if (newValue) {
|
|
1471
|
-
flags |= mask;
|
|
1472
|
-
} else {
|
|
1473
|
-
flags &= ~mask;
|
|
1474
|
-
}
|
|
1475
|
-
return flags;
|
|
1476
|
-
}
|
|
1477
1468
|
/**
|
|
1478
1469
|
* A node in the state dependency root that observes other nodes, and can be observed itself.
|
|
1479
1470
|
*
|
|
@@ -1493,13 +1484,7 @@ function setFlag(flags, mask, newValue) {
|
|
|
1493
1484
|
*
|
|
1494
1485
|
* If at any point it's outside batch and it isn't observed: reset everything and go to 1.
|
|
1495
1486
|
*/
|
|
1496
|
-
_Symbol$toPrimitive$1 = Symbol.toPrimitive;
|
|
1497
1487
|
var ComputedValue = /*#__PURE__*/function () {
|
|
1498
|
-
// nodes we are looking at. Our value depends on these nodes
|
|
1499
|
-
// during tracking it's an array with new observed observers
|
|
1500
|
-
|
|
1501
|
-
// N.B: unminified as it is used by MST
|
|
1502
|
-
|
|
1503
1488
|
/**
|
|
1504
1489
|
* Create a new computed value based on a function expression.
|
|
1505
1490
|
*
|
|
@@ -1515,9 +1500,10 @@ var ComputedValue = /*#__PURE__*/function () {
|
|
|
1515
1500
|
function ComputedValue(options) {
|
|
1516
1501
|
this.dependenciesState_ = IDerivationState_.NOT_TRACKING_;
|
|
1517
1502
|
this.observing_ = [];
|
|
1503
|
+
// nodes we are looking at. Our value depends on these nodes
|
|
1518
1504
|
this.newObserving_ = null;
|
|
1505
|
+
// during tracking it's an array with new observed observers
|
|
1519
1506
|
this.observers_ = new Set();
|
|
1520
|
-
this.diffValue_ = 0;
|
|
1521
1507
|
this.runId_ = 0;
|
|
1522
1508
|
this.lastAccessedBy_ = 0;
|
|
1523
1509
|
this.lowestObserverState_ = IDerivationState_.UP_TO_DATE_;
|
|
@@ -1527,6 +1513,7 @@ var ComputedValue = /*#__PURE__*/function () {
|
|
|
1527
1513
|
this.triggeredBy_ = void 0;
|
|
1528
1514
|
this.flags_ = 0;
|
|
1529
1515
|
this.derivation = void 0;
|
|
1516
|
+
// N.B: unminified as it is used by MST
|
|
1530
1517
|
this.setter_ = void 0;
|
|
1531
1518
|
this.isTracing_ = TraceMode.NONE;
|
|
1532
1519
|
this.scope_ = void 0;
|
|
@@ -1708,10 +1695,10 @@ var ComputedValue = /*#__PURE__*/function () {
|
|
|
1708
1695
|
_proto.valueOf = function valueOf() {
|
|
1709
1696
|
return toPrimitive(this.get());
|
|
1710
1697
|
};
|
|
1711
|
-
_proto[
|
|
1698
|
+
_proto[Symbol.toPrimitive] = function () {
|
|
1712
1699
|
return this.valueOf();
|
|
1713
1700
|
};
|
|
1714
|
-
_createClass(ComputedValue, [{
|
|
1701
|
+
return _createClass(ComputedValue, [{
|
|
1715
1702
|
key: "isComputing",
|
|
1716
1703
|
get: function get() {
|
|
1717
1704
|
return getFlag(this.flags_, ComputedValue.isComputingMask_);
|
|
@@ -1743,13 +1730,21 @@ var ComputedValue = /*#__PURE__*/function () {
|
|
|
1743
1730
|
set: function set(newValue) {
|
|
1744
1731
|
this.flags_ = setFlag(this.flags_, ComputedValue.isPendingUnobservationMask_, newValue);
|
|
1745
1732
|
}
|
|
1733
|
+
}, {
|
|
1734
|
+
key: "diffValue",
|
|
1735
|
+
get: function get() {
|
|
1736
|
+
return getFlag(this.flags_, ComputedValue.diffValueMask_) ? 1 : 0;
|
|
1737
|
+
},
|
|
1738
|
+
set: function set(newValue) {
|
|
1739
|
+
this.flags_ = setFlag(this.flags_, ComputedValue.diffValueMask_, newValue === 1 ? true : false);
|
|
1740
|
+
}
|
|
1746
1741
|
}]);
|
|
1747
|
-
return ComputedValue;
|
|
1748
1742
|
}();
|
|
1749
1743
|
ComputedValue.isComputingMask_ = 1;
|
|
1750
1744
|
ComputedValue.isRunningSetterMask_ = 2;
|
|
1751
1745
|
ComputedValue.isBeingObservedMask_ = 4;
|
|
1752
1746
|
ComputedValue.isPendingUnobservationMask_ = 8;
|
|
1747
|
+
ComputedValue.diffValueMask_ = 16;
|
|
1753
1748
|
var isComputedValue = /*#__PURE__*/createInstanceofPredicate("ComputedValue", ComputedValue);
|
|
1754
1749
|
|
|
1755
1750
|
var IDerivationState_;
|
|
@@ -1783,7 +1778,6 @@ var CaughtException = function CaughtException(cause) {
|
|
|
1783
1778
|
this.cause = cause;
|
|
1784
1779
|
// Empty
|
|
1785
1780
|
};
|
|
1786
|
-
|
|
1787
1781
|
function isCaughtException(e) {
|
|
1788
1782
|
return e instanceof CaughtException;
|
|
1789
1783
|
}
|
|
@@ -1847,7 +1841,6 @@ function shouldCompute(derivation) {
|
|
|
1847
1841
|
function isComputingDerivation() {
|
|
1848
1842
|
return globalState.trackingDerivation !== null; // filter out actions inside computations
|
|
1849
1843
|
}
|
|
1850
|
-
|
|
1851
1844
|
function checkIfStateModificationsAreAllowed(atom) {
|
|
1852
1845
|
var hasObservers = atom.observers_.size > 0;
|
|
1853
1846
|
// Should not be possible to change observed state outside strict mode, except during initialization, see #563
|
|
@@ -1920,8 +1913,8 @@ function bindDependencies(derivation) {
|
|
|
1920
1913
|
l = derivation.unboundDepsCount_;
|
|
1921
1914
|
for (var i = 0; i < l; i++) {
|
|
1922
1915
|
var dep = observing[i];
|
|
1923
|
-
if (dep.
|
|
1924
|
-
dep.
|
|
1916
|
+
if (dep.diffValue === 0) {
|
|
1917
|
+
dep.diffValue = 1;
|
|
1925
1918
|
if (i0 !== i) {
|
|
1926
1919
|
observing[i0] = dep;
|
|
1927
1920
|
}
|
|
@@ -1941,18 +1934,18 @@ function bindDependencies(derivation) {
|
|
|
1941
1934
|
l = prevObserving.length;
|
|
1942
1935
|
while (l--) {
|
|
1943
1936
|
var _dep = prevObserving[l];
|
|
1944
|
-
if (_dep.
|
|
1937
|
+
if (_dep.diffValue === 0) {
|
|
1945
1938
|
removeObserver(_dep, derivation);
|
|
1946
1939
|
}
|
|
1947
|
-
_dep.
|
|
1940
|
+
_dep.diffValue = 0;
|
|
1948
1941
|
}
|
|
1949
1942
|
// Go through all new observables and check diffValue: (now it should be unique)
|
|
1950
1943
|
// 0: it was set to 0 in last loop. don't need to do anything.
|
|
1951
1944
|
// 1: it wasn't observed, let's observe it. set back to 0
|
|
1952
1945
|
while (i0--) {
|
|
1953
1946
|
var _dep2 = observing[i0];
|
|
1954
|
-
if (_dep2.
|
|
1955
|
-
_dep2.
|
|
1947
|
+
if (_dep2.diffValue === 1) {
|
|
1948
|
+
_dep2.diffValue = 0;
|
|
1956
1949
|
addObserver(_dep2, derivation);
|
|
1957
1950
|
}
|
|
1958
1951
|
}
|
|
@@ -2018,28 +2011,113 @@ function changeDependenciesStateTo0(derivation) {
|
|
|
2018
2011
|
*/
|
|
2019
2012
|
var persistentKeys = ["mobxGuid", "spyListeners", "enforceActions", "computedRequiresReaction", "reactionRequiresObservable", "observableRequiresReaction", "allowStateReads", "disableErrorBoundaries", "runId", "UNCHANGED", "useProxies"];
|
|
2020
2013
|
var MobXGlobals = function MobXGlobals() {
|
|
2014
|
+
/**
|
|
2015
|
+
* MobXGlobals version.
|
|
2016
|
+
* MobX compatiblity with other versions loaded in memory as long as this version matches.
|
|
2017
|
+
* It indicates that the global state still stores similar information
|
|
2018
|
+
*
|
|
2019
|
+
* N.B: this version is unrelated to the package version of MobX, and is only the version of the
|
|
2020
|
+
* internal state storage of MobX, and can be the same across many different package versions
|
|
2021
|
+
*/
|
|
2021
2022
|
this.version = 6;
|
|
2023
|
+
/**
|
|
2024
|
+
* globally unique token to signal unchanged
|
|
2025
|
+
*/
|
|
2022
2026
|
this.UNCHANGED = {};
|
|
2027
|
+
/**
|
|
2028
|
+
* Currently running derivation
|
|
2029
|
+
*/
|
|
2023
2030
|
this.trackingDerivation = null;
|
|
2031
|
+
/**
|
|
2032
|
+
* Currently running reaction. This determines if we currently have a reactive context.
|
|
2033
|
+
* (Tracking derivation is also set for temporal tracking of computed values inside actions,
|
|
2034
|
+
* but trackingReaction can only be set by a form of Reaction)
|
|
2035
|
+
*/
|
|
2024
2036
|
this.trackingContext = null;
|
|
2037
|
+
/**
|
|
2038
|
+
* Each time a derivation is tracked, it is assigned a unique run-id
|
|
2039
|
+
*/
|
|
2025
2040
|
this.runId = 0;
|
|
2041
|
+
/**
|
|
2042
|
+
* 'guid' for general purpose. Will be persisted amongst resets.
|
|
2043
|
+
*/
|
|
2026
2044
|
this.mobxGuid = 0;
|
|
2045
|
+
/**
|
|
2046
|
+
* Are we in a batch block? (and how many of them)
|
|
2047
|
+
*/
|
|
2027
2048
|
this.inBatch = 0;
|
|
2049
|
+
/**
|
|
2050
|
+
* Observables that don't have observers anymore, and are about to be
|
|
2051
|
+
* suspended, unless somebody else accesses it in the same batch
|
|
2052
|
+
*
|
|
2053
|
+
* @type {IObservable[]}
|
|
2054
|
+
*/
|
|
2028
2055
|
this.pendingUnobservations = [];
|
|
2056
|
+
/**
|
|
2057
|
+
* List of scheduled, not yet executed, reactions.
|
|
2058
|
+
*/
|
|
2029
2059
|
this.pendingReactions = [];
|
|
2060
|
+
/**
|
|
2061
|
+
* Are we currently processing reactions?
|
|
2062
|
+
*/
|
|
2030
2063
|
this.isRunningReactions = false;
|
|
2064
|
+
/**
|
|
2065
|
+
* Is it allowed to change observables at this point?
|
|
2066
|
+
* In general, MobX doesn't allow that when running computations and React.render.
|
|
2067
|
+
* To ensure that those functions stay pure.
|
|
2068
|
+
*/
|
|
2031
2069
|
this.allowStateChanges = false;
|
|
2070
|
+
/**
|
|
2071
|
+
* Is it allowed to read observables at this point?
|
|
2072
|
+
* Used to hold the state needed for `observableRequiresReaction`
|
|
2073
|
+
*/
|
|
2032
2074
|
this.allowStateReads = true;
|
|
2075
|
+
/**
|
|
2076
|
+
* If strict mode is enabled, state changes are by default not allowed
|
|
2077
|
+
*/
|
|
2033
2078
|
this.enforceActions = true;
|
|
2079
|
+
/**
|
|
2080
|
+
* Spy callbacks
|
|
2081
|
+
*/
|
|
2034
2082
|
this.spyListeners = [];
|
|
2083
|
+
/**
|
|
2084
|
+
* Globally attached error handlers that react specifically to errors in reactions
|
|
2085
|
+
*/
|
|
2035
2086
|
this.globalReactionErrorHandlers = [];
|
|
2087
|
+
/**
|
|
2088
|
+
* Warn if computed values are accessed outside a reactive context
|
|
2089
|
+
*/
|
|
2036
2090
|
this.computedRequiresReaction = false;
|
|
2091
|
+
/**
|
|
2092
|
+
* (Experimental)
|
|
2093
|
+
* Warn if you try to create to derivation / reactive context without accessing any observable.
|
|
2094
|
+
*/
|
|
2037
2095
|
this.reactionRequiresObservable = false;
|
|
2096
|
+
/**
|
|
2097
|
+
* (Experimental)
|
|
2098
|
+
* Warn if observables are accessed outside a reactive context
|
|
2099
|
+
*/
|
|
2038
2100
|
this.observableRequiresReaction = false;
|
|
2101
|
+
/*
|
|
2102
|
+
* Don't catch and rethrow exceptions. This is useful for inspecting the state of
|
|
2103
|
+
* the stack when an exception occurs while debugging.
|
|
2104
|
+
*/
|
|
2039
2105
|
this.disableErrorBoundaries = false;
|
|
2106
|
+
/*
|
|
2107
|
+
* If true, we are already handling an exception in an action. Any errors in reactions should be suppressed, as
|
|
2108
|
+
* they are not the cause, see: https://github.com/mobxjs/mobx/issues/1836
|
|
2109
|
+
*/
|
|
2040
2110
|
this.suppressReactionErrors = false;
|
|
2041
2111
|
this.useProxies = true;
|
|
2112
|
+
/*
|
|
2113
|
+
* print warnings about code that would fail if proxies weren't available
|
|
2114
|
+
*/
|
|
2042
2115
|
this.verifyProxies = false;
|
|
2116
|
+
/**
|
|
2117
|
+
* False forces all object's descriptors to
|
|
2118
|
+
* writable: true
|
|
2119
|
+
* configurable: true
|
|
2120
|
+
*/
|
|
2043
2121
|
this.safeDescriptors = true;
|
|
2044
2122
|
};
|
|
2045
2123
|
var canMergeGlobalState = true;
|
|
@@ -2136,7 +2214,6 @@ function addObserver(observable, node) {
|
|
|
2136
2214
|
// invariantObservers(observable);
|
|
2137
2215
|
// invariant(observable._observers.indexOf(node) !== -1, "INTERNAL ERROR didn't add node");
|
|
2138
2216
|
}
|
|
2139
|
-
|
|
2140
2217
|
function removeObserver(observable, node) {
|
|
2141
2218
|
// invariant(globalState.inBatch > 0, "INTERNAL ERROR, remove should be called only inside batch");
|
|
2142
2219
|
// invariant(observable._observers.indexOf(node) !== -1, "INTERNAL ERROR remove already removed node");
|
|
@@ -2149,7 +2226,6 @@ function removeObserver(observable, node) {
|
|
|
2149
2226
|
// invariantObservers(observable);
|
|
2150
2227
|
// invariant(observable._observers.indexOf(node) === -1, "INTERNAL ERROR remove already removed node2");
|
|
2151
2228
|
}
|
|
2152
|
-
|
|
2153
2229
|
function queueForUnobservation(observable) {
|
|
2154
2230
|
if (observable.isPendingUnobservation === false) {
|
|
2155
2231
|
// invariant(observable._observers.length === 0, "INTERNAL ERROR, should only queue for unobservation unobserved observables");
|
|
@@ -2287,7 +2363,6 @@ function propagateMaybeChanged(observable) {
|
|
|
2287
2363
|
});
|
|
2288
2364
|
// invariantLOS(observable, "maybe end");
|
|
2289
2365
|
}
|
|
2290
|
-
|
|
2291
2366
|
function logTraceInfo(derivation, observable) {
|
|
2292
2367
|
console.log("[mobx.trace] '" + derivation.name_ + "' is invalidated due to a change in: '" + observable.name_ + "'");
|
|
2293
2368
|
if (derivation.isTracing_ === TraceMode.BREAK) {
|
|
@@ -2311,8 +2386,6 @@ function printDepTree(tree, lines, depth) {
|
|
|
2311
2386
|
}
|
|
2312
2387
|
|
|
2313
2388
|
var Reaction = /*#__PURE__*/function () {
|
|
2314
|
-
// nodes we are looking at. Our value depends on these nodes
|
|
2315
|
-
|
|
2316
2389
|
function Reaction(name_, onInvalidate_, errorHandler_, requiresObservable_) {
|
|
2317
2390
|
if (name_ === void 0) {
|
|
2318
2391
|
name_ = "Reaction@" + getNextId() ;
|
|
@@ -2322,15 +2395,12 @@ var Reaction = /*#__PURE__*/function () {
|
|
|
2322
2395
|
this.errorHandler_ = void 0;
|
|
2323
2396
|
this.requiresObservable_ = void 0;
|
|
2324
2397
|
this.observing_ = [];
|
|
2398
|
+
// nodes we are looking at. Our value depends on these nodes
|
|
2325
2399
|
this.newObserving_ = [];
|
|
2326
2400
|
this.dependenciesState_ = IDerivationState_.NOT_TRACKING_;
|
|
2327
|
-
this.diffValue_ = 0;
|
|
2328
2401
|
this.runId_ = 0;
|
|
2329
2402
|
this.unboundDepsCount_ = 0;
|
|
2330
|
-
this.
|
|
2331
|
-
this.isScheduled_ = false;
|
|
2332
|
-
this.isTrackPending_ = false;
|
|
2333
|
-
this.isRunning_ = false;
|
|
2403
|
+
this.flags_ = 0;
|
|
2334
2404
|
this.isTracing_ = TraceMode.NONE;
|
|
2335
2405
|
this.name_ = name_;
|
|
2336
2406
|
this.onInvalidate_ = onInvalidate_;
|
|
@@ -2342,29 +2412,26 @@ var Reaction = /*#__PURE__*/function () {
|
|
|
2342
2412
|
this.schedule_();
|
|
2343
2413
|
};
|
|
2344
2414
|
_proto.schedule_ = function schedule_() {
|
|
2345
|
-
if (!this.
|
|
2346
|
-
this.
|
|
2415
|
+
if (!this.isScheduled) {
|
|
2416
|
+
this.isScheduled = true;
|
|
2347
2417
|
globalState.pendingReactions.push(this);
|
|
2348
2418
|
runReactions();
|
|
2349
2419
|
}
|
|
2350
|
-
};
|
|
2351
|
-
_proto.isScheduled = function isScheduled() {
|
|
2352
|
-
return this.isScheduled_;
|
|
2353
2420
|
}
|
|
2354
2421
|
/**
|
|
2355
2422
|
* internal, use schedule() if you intend to kick off a reaction
|
|
2356
2423
|
*/;
|
|
2357
2424
|
_proto.runReaction_ = function runReaction_() {
|
|
2358
|
-
if (!this.
|
|
2425
|
+
if (!this.isDisposed) {
|
|
2359
2426
|
startBatch();
|
|
2360
|
-
this.
|
|
2427
|
+
this.isScheduled = false;
|
|
2361
2428
|
var prev = globalState.trackingContext;
|
|
2362
2429
|
globalState.trackingContext = this;
|
|
2363
2430
|
if (shouldCompute(this)) {
|
|
2364
|
-
this.
|
|
2431
|
+
this.isTrackPending = true;
|
|
2365
2432
|
try {
|
|
2366
2433
|
this.onInvalidate_();
|
|
2367
|
-
if ("development" !== "production" && this.
|
|
2434
|
+
if ("development" !== "production" && this.isTrackPending && isSpyEnabled()) {
|
|
2368
2435
|
// onInvalidate didn't trigger track right away..
|
|
2369
2436
|
spyReport({
|
|
2370
2437
|
name: this.name_,
|
|
@@ -2380,11 +2447,10 @@ var Reaction = /*#__PURE__*/function () {
|
|
|
2380
2447
|
}
|
|
2381
2448
|
};
|
|
2382
2449
|
_proto.track = function track(fn) {
|
|
2383
|
-
if (this.
|
|
2450
|
+
if (this.isDisposed) {
|
|
2384
2451
|
return;
|
|
2385
2452
|
// console.warn("Reaction already disposed") // Note: Not a warning / error in mobx 4 either
|
|
2386
2453
|
}
|
|
2387
|
-
|
|
2388
2454
|
startBatch();
|
|
2389
2455
|
var notify = isSpyEnabled();
|
|
2390
2456
|
var startTime;
|
|
@@ -2395,14 +2461,14 @@ var Reaction = /*#__PURE__*/function () {
|
|
|
2395
2461
|
type: "reaction"
|
|
2396
2462
|
});
|
|
2397
2463
|
}
|
|
2398
|
-
this.
|
|
2464
|
+
this.isRunning = true;
|
|
2399
2465
|
var prevReaction = globalState.trackingContext; // reactions could create reactions...
|
|
2400
2466
|
globalState.trackingContext = this;
|
|
2401
2467
|
var result = trackDerivedFunction(this, fn, undefined);
|
|
2402
2468
|
globalState.trackingContext = prevReaction;
|
|
2403
|
-
this.
|
|
2404
|
-
this.
|
|
2405
|
-
if (this.
|
|
2469
|
+
this.isRunning = false;
|
|
2470
|
+
this.isTrackPending = false;
|
|
2471
|
+
if (this.isDisposed) {
|
|
2406
2472
|
// disposed during last run. Clean up everything that was bound after the dispose call.
|
|
2407
2473
|
clearObserving(this);
|
|
2408
2474
|
}
|
|
@@ -2445,9 +2511,9 @@ var Reaction = /*#__PURE__*/function () {
|
|
|
2445
2511
|
});
|
|
2446
2512
|
};
|
|
2447
2513
|
_proto.dispose = function dispose() {
|
|
2448
|
-
if (!this.
|
|
2449
|
-
this.
|
|
2450
|
-
if (!this.
|
|
2514
|
+
if (!this.isDisposed) {
|
|
2515
|
+
this.isDisposed = true;
|
|
2516
|
+
if (!this.isRunning) {
|
|
2451
2517
|
// if disposed while running, clean up later. Maybe not optimal, but rare case
|
|
2452
2518
|
startBatch();
|
|
2453
2519
|
clearObserving(this);
|
|
@@ -2459,9 +2525,9 @@ var Reaction = /*#__PURE__*/function () {
|
|
|
2459
2525
|
var _this2 = this;
|
|
2460
2526
|
var dispose = function dispose() {
|
|
2461
2527
|
_this2.dispose();
|
|
2462
|
-
abortSignal == null
|
|
2528
|
+
abortSignal == null || abortSignal.removeEventListener == null || abortSignal.removeEventListener("abort", dispose);
|
|
2463
2529
|
};
|
|
2464
|
-
abortSignal == null
|
|
2530
|
+
abortSignal == null || abortSignal.addEventListener == null || abortSignal.addEventListener("abort", dispose);
|
|
2465
2531
|
dispose[$mobx] = this;
|
|
2466
2532
|
return dispose;
|
|
2467
2533
|
};
|
|
@@ -2474,8 +2540,53 @@ var Reaction = /*#__PURE__*/function () {
|
|
|
2474
2540
|
}
|
|
2475
2541
|
trace(this, enterBreakPoint);
|
|
2476
2542
|
};
|
|
2477
|
-
return Reaction
|
|
2543
|
+
return _createClass(Reaction, [{
|
|
2544
|
+
key: "isDisposed",
|
|
2545
|
+
get: function get() {
|
|
2546
|
+
return getFlag(this.flags_, Reaction.isDisposedMask_);
|
|
2547
|
+
},
|
|
2548
|
+
set: function set(newValue) {
|
|
2549
|
+
this.flags_ = setFlag(this.flags_, Reaction.isDisposedMask_, newValue);
|
|
2550
|
+
}
|
|
2551
|
+
}, {
|
|
2552
|
+
key: "isScheduled",
|
|
2553
|
+
get: function get() {
|
|
2554
|
+
return getFlag(this.flags_, Reaction.isScheduledMask_);
|
|
2555
|
+
},
|
|
2556
|
+
set: function set(newValue) {
|
|
2557
|
+
this.flags_ = setFlag(this.flags_, Reaction.isScheduledMask_, newValue);
|
|
2558
|
+
}
|
|
2559
|
+
}, {
|
|
2560
|
+
key: "isTrackPending",
|
|
2561
|
+
get: function get() {
|
|
2562
|
+
return getFlag(this.flags_, Reaction.isTrackPendingMask_);
|
|
2563
|
+
},
|
|
2564
|
+
set: function set(newValue) {
|
|
2565
|
+
this.flags_ = setFlag(this.flags_, Reaction.isTrackPendingMask_, newValue);
|
|
2566
|
+
}
|
|
2567
|
+
}, {
|
|
2568
|
+
key: "isRunning",
|
|
2569
|
+
get: function get() {
|
|
2570
|
+
return getFlag(this.flags_, Reaction.isRunningMask_);
|
|
2571
|
+
},
|
|
2572
|
+
set: function set(newValue) {
|
|
2573
|
+
this.flags_ = setFlag(this.flags_, Reaction.isRunningMask_, newValue);
|
|
2574
|
+
}
|
|
2575
|
+
}, {
|
|
2576
|
+
key: "diffValue",
|
|
2577
|
+
get: function get() {
|
|
2578
|
+
return getFlag(this.flags_, Reaction.diffValueMask_) ? 1 : 0;
|
|
2579
|
+
},
|
|
2580
|
+
set: function set(newValue) {
|
|
2581
|
+
this.flags_ = setFlag(this.flags_, Reaction.diffValueMask_, newValue === 1 ? true : false);
|
|
2582
|
+
}
|
|
2583
|
+
}]);
|
|
2478
2584
|
}();
|
|
2585
|
+
Reaction.isDisposedMask_ = 1;
|
|
2586
|
+
Reaction.isScheduledMask_ = 2;
|
|
2587
|
+
Reaction.isTrackPendingMask_ = 4;
|
|
2588
|
+
Reaction.isRunningMask_ = 8;
|
|
2589
|
+
Reaction.diffValueMask_ = 16;
|
|
2479
2590
|
function onReactionError(handler) {
|
|
2480
2591
|
globalState.globalReactionErrorHandlers.push(handler);
|
|
2481
2592
|
return function () {
|
|
@@ -2513,7 +2624,6 @@ function runReactionsHelper() {
|
|
|
2513
2624
|
console.error( "Reaction doesn't converge to a stable state after " + MAX_REACTION_ITERATIONS + " iterations." + (" Probably there is a cycle in the reactive function: " + allReactions[0]) );
|
|
2514
2625
|
allReactions.splice(0); // clear reactions
|
|
2515
2626
|
}
|
|
2516
|
-
|
|
2517
2627
|
var remainingReactions = allReactions.splice(0);
|
|
2518
2628
|
for (var i = 0, l = remainingReactions.length; i < l; i++) {
|
|
2519
2629
|
remainingReactions[i].runReaction_();
|
|
@@ -2641,7 +2751,7 @@ function isAction(thing) {
|
|
|
2641
2751
|
* @returns disposer function, which can be used to stop the view from being updated in the future.
|
|
2642
2752
|
*/
|
|
2643
2753
|
function autorun(view, opts) {
|
|
2644
|
-
var _opts$name, _opts, _opts2,
|
|
2754
|
+
var _opts$name, _opts, _opts2, _opts3;
|
|
2645
2755
|
if (opts === void 0) {
|
|
2646
2756
|
opts = EMPTY_OBJECT;
|
|
2647
2757
|
}
|
|
@@ -2670,7 +2780,7 @@ function autorun(view, opts) {
|
|
|
2670
2780
|
isScheduled = true;
|
|
2671
2781
|
scheduler(function () {
|
|
2672
2782
|
isScheduled = false;
|
|
2673
|
-
if (!reaction.
|
|
2783
|
+
if (!reaction.isDisposed) {
|
|
2674
2784
|
reaction.track(reactionRunner);
|
|
2675
2785
|
}
|
|
2676
2786
|
});
|
|
@@ -2680,7 +2790,7 @@ function autorun(view, opts) {
|
|
|
2680
2790
|
function reactionRunner() {
|
|
2681
2791
|
view(reaction);
|
|
2682
2792
|
}
|
|
2683
|
-
if (!((_opts2 = opts) != null && (_opts2
|
|
2793
|
+
if (!((_opts2 = opts) != null && (_opts2 = _opts2.signal) != null && _opts2.aborted)) {
|
|
2684
2794
|
reaction.schedule_();
|
|
2685
2795
|
}
|
|
2686
2796
|
return reaction.getDisposer_((_opts3 = opts) == null ? void 0 : _opts3.signal);
|
|
@@ -2694,7 +2804,7 @@ function createSchedulerFromOptions(opts) {
|
|
|
2694
2804
|
} : run;
|
|
2695
2805
|
}
|
|
2696
2806
|
function reaction(expression, effect, opts) {
|
|
2697
|
-
var _opts$name2, _opts4,
|
|
2807
|
+
var _opts$name2, _opts4, _opts5;
|
|
2698
2808
|
if (opts === void 0) {
|
|
2699
2809
|
opts = EMPTY_OBJECT;
|
|
2700
2810
|
}
|
|
@@ -2724,7 +2834,7 @@ function reaction(expression, effect, opts) {
|
|
|
2724
2834
|
}, opts.onError, opts.requiresObservable);
|
|
2725
2835
|
function reactionRunner() {
|
|
2726
2836
|
isScheduled = false;
|
|
2727
|
-
if (r.
|
|
2837
|
+
if (r.isDisposed) {
|
|
2728
2838
|
return;
|
|
2729
2839
|
}
|
|
2730
2840
|
var changed = false;
|
|
@@ -2743,7 +2853,7 @@ function reaction(expression, effect, opts) {
|
|
|
2743
2853
|
}
|
|
2744
2854
|
firstTime = false;
|
|
2745
2855
|
}
|
|
2746
|
-
if (!((_opts4 = opts) != null && (_opts4
|
|
2856
|
+
if (!((_opts4 = opts) != null && (_opts4 = _opts4.signal) != null && _opts4.aborted)) {
|
|
2747
2857
|
r.schedule_();
|
|
2748
2858
|
}
|
|
2749
2859
|
return r.getDisposer_((_opts5 = opts) == null ? void 0 : _opts5.signal);
|
|
@@ -2952,7 +3062,6 @@ var flow = /*#__PURE__*/Object.assign(function flow(arg1, arg2) {
|
|
|
2952
3062
|
}
|
|
2953
3063
|
onFulfilled(undefined); // kick off the process
|
|
2954
3064
|
});
|
|
2955
|
-
|
|
2956
3065
|
promise.cancel = action(name + " - runid: " + runId + " - cancel", function () {
|
|
2957
3066
|
try {
|
|
2958
3067
|
if (pendingPromise) {
|
|
@@ -2970,7 +3079,6 @@ var flow = /*#__PURE__*/Object.assign(function flow(arg1, arg2) {
|
|
|
2970
3079
|
rejector(e); // there could be a throwing finally block
|
|
2971
3080
|
}
|
|
2972
3081
|
});
|
|
2973
|
-
|
|
2974
3082
|
return promise;
|
|
2975
3083
|
};
|
|
2976
3084
|
res.isMobXFlow = true;
|
|
@@ -2985,7 +3093,6 @@ function cancelPromise(promise) {
|
|
|
2985
3093
|
function flowResult(result) {
|
|
2986
3094
|
return result; // just tricking TypeScript :)
|
|
2987
3095
|
}
|
|
2988
|
-
|
|
2989
3096
|
function isFlow(fn) {
|
|
2990
3097
|
return (fn == null ? void 0 : fn.isMobXFlow) === true;
|
|
2991
3098
|
}
|
|
@@ -3354,7 +3461,7 @@ function _when(predicate, effect, opts) {
|
|
|
3354
3461
|
if (typeof opts.timeout === "number") {
|
|
3355
3462
|
var error = new Error("WHEN_TIMEOUT");
|
|
3356
3463
|
timeoutHandle = setTimeout(function () {
|
|
3357
|
-
if (!disposer[$mobx].
|
|
3464
|
+
if (!disposer[$mobx].isDisposed) {
|
|
3358
3465
|
disposer();
|
|
3359
3466
|
if (opts.onError) {
|
|
3360
3467
|
opts.onError(error);
|
|
@@ -3407,10 +3514,10 @@ function whenPromise(predicate, opts) {
|
|
|
3407
3514
|
disposer();
|
|
3408
3515
|
reject(new Error("WHEN_ABORTED"));
|
|
3409
3516
|
};
|
|
3410
|
-
opts == null
|
|
3517
|
+
opts == null || (_opts$signal2 = opts.signal) == null || _opts$signal2.addEventListener == null || _opts$signal2.addEventListener("abort", abort);
|
|
3411
3518
|
})["finally"](function () {
|
|
3412
3519
|
var _opts$signal3;
|
|
3413
|
-
return opts == null
|
|
3520
|
+
return opts == null || (_opts$signal3 = opts.signal) == null || _opts$signal3.removeEventListener == null ? void 0 : _opts$signal3.removeEventListener("abort", abort);
|
|
3414
3521
|
});
|
|
3415
3522
|
res.cancel = cancel;
|
|
3416
3523
|
return res;
|
|
@@ -3627,8 +3734,6 @@ var arrayTraps = {
|
|
|
3627
3734
|
}
|
|
3628
3735
|
};
|
|
3629
3736
|
var ObservableArrayAdministration = /*#__PURE__*/function () {
|
|
3630
|
-
// this is the prop that gets proxied, so can't replace it!
|
|
3631
|
-
|
|
3632
3737
|
function ObservableArrayAdministration(name, enhancer, owned_, legacyMode_) {
|
|
3633
3738
|
if (name === void 0) {
|
|
3634
3739
|
name = "ObservableArray@" + getNextId() ;
|
|
@@ -3637,6 +3742,7 @@ var ObservableArrayAdministration = /*#__PURE__*/function () {
|
|
|
3637
3742
|
this.legacyMode_ = void 0;
|
|
3638
3743
|
this.atom_ = void 0;
|
|
3639
3744
|
this.values_ = [];
|
|
3745
|
+
// this is the prop that gets proxied, so can't replace it!
|
|
3640
3746
|
this.interceptors_ = void 0;
|
|
3641
3747
|
this.changeListeners_ = void 0;
|
|
3642
3748
|
this.enhancer_ = void 0;
|
|
@@ -3757,7 +3863,6 @@ var ObservableArrayAdministration = /*#__PURE__*/function () {
|
|
|
3757
3863
|
var lengthDelta = newItems.length - deleteCount;
|
|
3758
3864
|
this.updateArrayLength_(length, lengthDelta); // checks if internal array wasn't modified
|
|
3759
3865
|
}
|
|
3760
|
-
|
|
3761
3866
|
var res = this.spliceItemsIntoValues_(index, deleteCount, newItems);
|
|
3762
3867
|
if (deleteCount !== 0 || newItems.length !== 0) {
|
|
3763
3868
|
this.notifyArraySplice_(index, newItems, res);
|
|
@@ -3857,6 +3962,7 @@ var ObservableArrayAdministration = /*#__PURE__*/function () {
|
|
|
3857
3962
|
var change = interceptChange(this, {
|
|
3858
3963
|
type: UPDATE,
|
|
3859
3964
|
object: this.proxy_,
|
|
3965
|
+
// since "this" is the real array we need to pass its proxy
|
|
3860
3966
|
index: index,
|
|
3861
3967
|
newValue: newValue
|
|
3862
3968
|
});
|
|
@@ -4072,17 +4178,12 @@ function isObservableArray(thing) {
|
|
|
4072
4178
|
return isObject(thing) && isObservableArrayAdministration(thing[$mobx]);
|
|
4073
4179
|
}
|
|
4074
4180
|
|
|
4075
|
-
var _Symbol$iterator, _Symbol$toStringTag;
|
|
4076
4181
|
var ObservableMapMarker = {};
|
|
4077
4182
|
var ADD = "add";
|
|
4078
4183
|
var DELETE = "delete";
|
|
4079
4184
|
// just extend Map? See also https://gist.github.com/nestharus/13b4d74f2ef4a2f4357dbd3fc23c1e54
|
|
4080
4185
|
// But: https://github.com/mobxjs/mobx/issues/1556
|
|
4081
|
-
_Symbol$iterator = Symbol.iterator;
|
|
4082
|
-
_Symbol$toStringTag = Symbol.toStringTag;
|
|
4083
4186
|
var ObservableMap = /*#__PURE__*/function () {
|
|
4084
|
-
// hasMap, not hashMap >-).
|
|
4085
|
-
|
|
4086
4187
|
function ObservableMap(initialData, enhancer_, name_) {
|
|
4087
4188
|
var _this = this;
|
|
4088
4189
|
if (enhancer_ === void 0) {
|
|
@@ -4096,6 +4197,7 @@ var ObservableMap = /*#__PURE__*/function () {
|
|
|
4096
4197
|
this[$mobx] = ObservableMapMarker;
|
|
4097
4198
|
this.data_ = void 0;
|
|
4098
4199
|
this.hasMap_ = void 0;
|
|
4200
|
+
// hasMap, not hashMap >-).
|
|
4099
4201
|
this.keysAtom_ = void 0;
|
|
4100
4202
|
this.interceptors_ = void 0;
|
|
4101
4203
|
this.changeListeners_ = void 0;
|
|
@@ -4184,7 +4286,7 @@ var ObservableMap = /*#__PURE__*/function () {
|
|
|
4184
4286
|
transaction(function () {
|
|
4185
4287
|
var _this3$hasMap_$get;
|
|
4186
4288
|
_this3.keysAtom_.reportChanged();
|
|
4187
|
-
(_this3$hasMap_$get = _this3.hasMap_.get(key)) == null
|
|
4289
|
+
(_this3$hasMap_$get = _this3.hasMap_.get(key)) == null || _this3$hasMap_$get.setNewValue_(false);
|
|
4188
4290
|
var observable = _this3.data_.get(key);
|
|
4189
4291
|
observable.setNewValue_(undefined);
|
|
4190
4292
|
_this3.data_["delete"](key);
|
|
@@ -4234,7 +4336,7 @@ var ObservableMap = /*#__PURE__*/function () {
|
|
|
4234
4336
|
var observable = new ObservableValue(newValue, _this4.enhancer_, _this4.name_ + "." + stringifyKey(key) , false);
|
|
4235
4337
|
_this4.data_.set(key, observable);
|
|
4236
4338
|
newValue = observable.value_; // value might have been changed
|
|
4237
|
-
(_this4$hasMap_$get = _this4.hasMap_.get(key)) == null
|
|
4339
|
+
(_this4$hasMap_$get = _this4.hasMap_.get(key)) == null || _this4$hasMap_$get.setNewValue_(true);
|
|
4238
4340
|
_this4.keysAtom_.reportChanged();
|
|
4239
4341
|
});
|
|
4240
4342
|
var notifySpy = isSpyEnabled();
|
|
@@ -4303,7 +4405,7 @@ var ObservableMap = /*#__PURE__*/function () {
|
|
|
4303
4405
|
}
|
|
4304
4406
|
});
|
|
4305
4407
|
};
|
|
4306
|
-
_proto[
|
|
4408
|
+
_proto[Symbol.iterator] = function () {
|
|
4307
4409
|
return this.entries();
|
|
4308
4410
|
};
|
|
4309
4411
|
_proto.forEach = function forEach(callback, thisArg) {
|
|
@@ -4457,19 +4559,18 @@ var ObservableMap = /*#__PURE__*/function () {
|
|
|
4457
4559
|
_proto.intercept_ = function intercept_(handler) {
|
|
4458
4560
|
return registerInterceptor(this, handler);
|
|
4459
4561
|
};
|
|
4460
|
-
_createClass(ObservableMap, [{
|
|
4562
|
+
return _createClass(ObservableMap, [{
|
|
4461
4563
|
key: "size",
|
|
4462
4564
|
get: function get() {
|
|
4463
4565
|
this.keysAtom_.reportObserved();
|
|
4464
4566
|
return this.data_.size;
|
|
4465
4567
|
}
|
|
4466
4568
|
}, {
|
|
4467
|
-
key:
|
|
4569
|
+
key: Symbol.toStringTag,
|
|
4468
4570
|
get: function get() {
|
|
4469
4571
|
return "Map";
|
|
4470
4572
|
}
|
|
4471
4573
|
}]);
|
|
4472
|
-
return ObservableMap;
|
|
4473
4574
|
}();
|
|
4474
4575
|
// eslint-disable-next-line
|
|
4475
4576
|
var isObservableMap = /*#__PURE__*/createInstanceofPredicate("ObservableMap", ObservableMap);
|
|
@@ -4489,10 +4590,7 @@ function convertToMap(dataStructure) {
|
|
|
4489
4590
|
}
|
|
4490
4591
|
}
|
|
4491
4592
|
|
|
4492
|
-
var _Symbol$iterator$1, _Symbol$toStringTag$1;
|
|
4493
4593
|
var ObservableSetMarker = {};
|
|
4494
|
-
_Symbol$iterator$1 = Symbol.iterator;
|
|
4495
|
-
_Symbol$toStringTag$1 = Symbol.toStringTag;
|
|
4496
4594
|
var ObservableSet = /*#__PURE__*/function () {
|
|
4497
4595
|
function ObservableSet(initialData, enhancer, name_) {
|
|
4498
4596
|
var _this = this;
|
|
@@ -4563,7 +4661,6 @@ var ObservableSet = /*#__PURE__*/function () {
|
|
|
4563
4661
|
// ideally, value = change.value would be done here, so that values can be
|
|
4564
4662
|
// changed by interceptor. Same applies for other Set and Map api's.
|
|
4565
4663
|
}
|
|
4566
|
-
|
|
4567
4664
|
if (!this.has(value)) {
|
|
4568
4665
|
transaction(function () {
|
|
4569
4666
|
_this3.data_.add(_this3.enhancer_(value, undefined));
|
|
@@ -4669,6 +4766,47 @@ var ObservableSet = /*#__PURE__*/function () {
|
|
|
4669
4766
|
}
|
|
4670
4767
|
});
|
|
4671
4768
|
};
|
|
4769
|
+
_proto.intersection = function intersection(otherSet) {
|
|
4770
|
+
if (isES6Set(otherSet)) {
|
|
4771
|
+
return otherSet.intersection(this);
|
|
4772
|
+
} else {
|
|
4773
|
+
var dehancedSet = new Set(this);
|
|
4774
|
+
return dehancedSet.intersection(otherSet);
|
|
4775
|
+
}
|
|
4776
|
+
};
|
|
4777
|
+
_proto.union = function union(otherSet) {
|
|
4778
|
+
if (isES6Set(otherSet)) {
|
|
4779
|
+
return otherSet.union(this);
|
|
4780
|
+
} else {
|
|
4781
|
+
var dehancedSet = new Set(this);
|
|
4782
|
+
return dehancedSet.union(otherSet);
|
|
4783
|
+
}
|
|
4784
|
+
};
|
|
4785
|
+
_proto.difference = function difference(otherSet) {
|
|
4786
|
+
return new Set(this).difference(otherSet);
|
|
4787
|
+
};
|
|
4788
|
+
_proto.symmetricDifference = function symmetricDifference(otherSet) {
|
|
4789
|
+
if (isES6Set(otherSet)) {
|
|
4790
|
+
return otherSet.symmetricDifference(this);
|
|
4791
|
+
} else {
|
|
4792
|
+
var dehancedSet = new Set(this);
|
|
4793
|
+
return dehancedSet.symmetricDifference(otherSet);
|
|
4794
|
+
}
|
|
4795
|
+
};
|
|
4796
|
+
_proto.isSubsetOf = function isSubsetOf(otherSet) {
|
|
4797
|
+
return new Set(this).isSubsetOf(otherSet);
|
|
4798
|
+
};
|
|
4799
|
+
_proto.isSupersetOf = function isSupersetOf(otherSet) {
|
|
4800
|
+
return new Set(this).isSupersetOf(otherSet);
|
|
4801
|
+
};
|
|
4802
|
+
_proto.isDisjointFrom = function isDisjointFrom(otherSet) {
|
|
4803
|
+
if (isES6Set(otherSet)) {
|
|
4804
|
+
return otherSet.isDisjointFrom(this);
|
|
4805
|
+
} else {
|
|
4806
|
+
var dehancedSet = new Set(this);
|
|
4807
|
+
return dehancedSet.isDisjointFrom(otherSet);
|
|
4808
|
+
}
|
|
4809
|
+
};
|
|
4672
4810
|
_proto.replace = function replace(other) {
|
|
4673
4811
|
var _this5 = this;
|
|
4674
4812
|
if (isObservableSet(other)) {
|
|
@@ -4707,22 +4845,21 @@ var ObservableSet = /*#__PURE__*/function () {
|
|
|
4707
4845
|
_proto.toString = function toString() {
|
|
4708
4846
|
return "[object ObservableSet]";
|
|
4709
4847
|
};
|
|
4710
|
-
_proto[
|
|
4848
|
+
_proto[Symbol.iterator] = function () {
|
|
4711
4849
|
return this.values();
|
|
4712
4850
|
};
|
|
4713
|
-
_createClass(ObservableSet, [{
|
|
4851
|
+
return _createClass(ObservableSet, [{
|
|
4714
4852
|
key: "size",
|
|
4715
4853
|
get: function get() {
|
|
4716
4854
|
this.atom_.reportObserved();
|
|
4717
4855
|
return this.data_.size;
|
|
4718
4856
|
}
|
|
4719
4857
|
}, {
|
|
4720
|
-
key:
|
|
4858
|
+
key: Symbol.toStringTag,
|
|
4721
4859
|
get: function get() {
|
|
4722
4860
|
return "Set";
|
|
4723
4861
|
}
|
|
4724
4862
|
}]);
|
|
4725
|
-
return ObservableSet;
|
|
4726
4863
|
}();
|
|
4727
4864
|
// eslint-disable-next-line
|
|
4728
4865
|
var isObservableSet = /*#__PURE__*/createInstanceofPredicate("ObservableSet", ObservableSet);
|
|
@@ -5122,7 +5259,7 @@ var ObservableObjectAdministration = /*#__PURE__*/function () {
|
|
|
5122
5259
|
}
|
|
5123
5260
|
// Delete
|
|
5124
5261
|
try {
|
|
5125
|
-
var _this$pendingKeys_
|
|
5262
|
+
var _this$pendingKeys_;
|
|
5126
5263
|
startBatch();
|
|
5127
5264
|
var notify = hasListeners(this);
|
|
5128
5265
|
var notifySpy = "development" !== "production" && isSpyEnabled();
|
|
@@ -5160,7 +5297,7 @@ var ObservableObjectAdministration = /*#__PURE__*/function () {
|
|
|
5160
5297
|
this.keysAtom_.reportChanged();
|
|
5161
5298
|
// Notify "has" observers
|
|
5162
5299
|
// "in" as it may still exist in proto
|
|
5163
|
-
(_this$pendingKeys_ = this.pendingKeys_) == null
|
|
5300
|
+
(_this$pendingKeys_ = this.pendingKeys_) == null || (_this$pendingKeys_ = _this$pendingKeys_.get(key)) == null || _this$pendingKeys_.set(key in this.target_);
|
|
5164
5301
|
// Notify spies/listeners
|
|
5165
5302
|
if (notify || notifySpy) {
|
|
5166
5303
|
var _change2 = {
|
|
@@ -5201,7 +5338,7 @@ var ObservableObjectAdministration = /*#__PURE__*/function () {
|
|
|
5201
5338
|
return registerInterceptor(this, handler);
|
|
5202
5339
|
};
|
|
5203
5340
|
_proto.notifyPropertyAddition_ = function notifyPropertyAddition_(key, value) {
|
|
5204
|
-
var _this$pendingKeys_2
|
|
5341
|
+
var _this$pendingKeys_2;
|
|
5205
5342
|
var notify = hasListeners(this);
|
|
5206
5343
|
var notifySpy = isSpyEnabled();
|
|
5207
5344
|
if (notify || notifySpy) {
|
|
@@ -5223,7 +5360,7 @@ var ObservableObjectAdministration = /*#__PURE__*/function () {
|
|
|
5223
5360
|
spyReportEnd();
|
|
5224
5361
|
}
|
|
5225
5362
|
}
|
|
5226
|
-
(_this$pendingKeys_2 = this.pendingKeys_) == null
|
|
5363
|
+
(_this$pendingKeys_2 = this.pendingKeys_) == null || (_this$pendingKeys_2 = _this$pendingKeys_2.get(key)) == null || _this$pendingKeys_2.set(true);
|
|
5227
5364
|
// Notify "keys/entries/values" observers
|
|
5228
5365
|
this.keysAtom_.reportChanged();
|
|
5229
5366
|
};
|
|
@@ -5285,7 +5422,7 @@ function recordAnnotationApplied(adm, annotation, key) {
|
|
|
5285
5422
|
adm.appliedAnnotations_[key] = annotation;
|
|
5286
5423
|
}
|
|
5287
5424
|
// Remove applied decorator annotation so we don't try to apply it again in subclass constructor
|
|
5288
|
-
(_adm$target_$storedAn = adm.target_[storedAnnotationsSymbol]) == null
|
|
5425
|
+
(_adm$target_$storedAn = adm.target_[storedAnnotationsSymbol]) == null || delete _adm$target_$storedAn[key];
|
|
5289
5426
|
}
|
|
5290
5427
|
function assertAnnotable(adm, annotation, key) {
|
|
5291
5428
|
// Valid annotation
|
|
@@ -5365,8 +5502,7 @@ inherit(StubArray, Array.prototype);
|
|
|
5365
5502
|
// Weex proto freeze protection was here,
|
|
5366
5503
|
// but it is unclear why the hack is need as MobX never changed the prototype
|
|
5367
5504
|
// anyway, so removed it in V6
|
|
5368
|
-
var LegacyObservableArray = /*#__PURE__*/function (_StubArray
|
|
5369
|
-
_inheritsLoose(LegacyObservableArray, _StubArray);
|
|
5505
|
+
var LegacyObservableArray = /*#__PURE__*/function (_StubArray) {
|
|
5370
5506
|
function LegacyObservableArray(initialValues, enhancer, name, owned) {
|
|
5371
5507
|
var _this;
|
|
5372
5508
|
if (name === void 0) {
|
|
@@ -5378,8 +5514,8 @@ var LegacyObservableArray = /*#__PURE__*/function (_StubArray, _Symbol$toStringT
|
|
|
5378
5514
|
_this = _StubArray.call(this) || this;
|
|
5379
5515
|
initObservable(function () {
|
|
5380
5516
|
var adm = new ObservableArrayAdministration(name, enhancer, owned, true);
|
|
5381
|
-
adm.proxy_ =
|
|
5382
|
-
addHiddenFinalProp(
|
|
5517
|
+
adm.proxy_ = _this;
|
|
5518
|
+
addHiddenFinalProp(_this, $mobx, adm);
|
|
5383
5519
|
if (initialValues && initialValues.length) {
|
|
5384
5520
|
// @ts-ignore
|
|
5385
5521
|
_this.spliceWithArray(0, 0, initialValues);
|
|
@@ -5387,11 +5523,12 @@ var LegacyObservableArray = /*#__PURE__*/function (_StubArray, _Symbol$toStringT
|
|
|
5387
5523
|
if (safariPrototypeSetterInheritanceBug) {
|
|
5388
5524
|
// Seems that Safari won't use numeric prototype setter until any * numeric property is
|
|
5389
5525
|
// defined on the instance. After that it works fine, even if this property is deleted.
|
|
5390
|
-
Object.defineProperty(
|
|
5526
|
+
Object.defineProperty(_this, "0", ENTRY_0);
|
|
5391
5527
|
}
|
|
5392
5528
|
});
|
|
5393
5529
|
return _this;
|
|
5394
5530
|
}
|
|
5531
|
+
_inheritsLoose(LegacyObservableArray, _StubArray);
|
|
5395
5532
|
var _proto = LegacyObservableArray.prototype;
|
|
5396
5533
|
_proto.concat = function concat() {
|
|
5397
5534
|
this[$mobx].atom_.reportObserved();
|
|
@@ -5404,7 +5541,7 @@ var LegacyObservableArray = /*#__PURE__*/function (_StubArray, _Symbol$toStringT
|
|
|
5404
5541
|
return isObservableArray(a) ? a.slice() : a;
|
|
5405
5542
|
}));
|
|
5406
5543
|
};
|
|
5407
|
-
_proto[
|
|
5544
|
+
_proto[Symbol.iterator] = function () {
|
|
5408
5545
|
var self = this;
|
|
5409
5546
|
var nextIndex = 0;
|
|
5410
5547
|
return makeIterable({
|
|
@@ -5419,7 +5556,7 @@ var LegacyObservableArray = /*#__PURE__*/function (_StubArray, _Symbol$toStringT
|
|
|
5419
5556
|
}
|
|
5420
5557
|
});
|
|
5421
5558
|
};
|
|
5422
|
-
_createClass(LegacyObservableArray, [{
|
|
5559
|
+
return _createClass(LegacyObservableArray, [{
|
|
5423
5560
|
key: "length",
|
|
5424
5561
|
get: function get() {
|
|
5425
5562
|
return this[$mobx].getArrayLength_();
|
|
@@ -5428,13 +5565,12 @@ var LegacyObservableArray = /*#__PURE__*/function (_StubArray, _Symbol$toStringT
|
|
|
5428
5565
|
this[$mobx].setArrayLength_(newLength);
|
|
5429
5566
|
}
|
|
5430
5567
|
}, {
|
|
5431
|
-
key:
|
|
5568
|
+
key: Symbol.toStringTag,
|
|
5432
5569
|
get: function get() {
|
|
5433
5570
|
return "Array";
|
|
5434
5571
|
}
|
|
5435
5572
|
}]);
|
|
5436
|
-
|
|
5437
|
-
}(StubArray, Symbol.toStringTag, Symbol.iterator);
|
|
5573
|
+
}(StubArray);
|
|
5438
5574
|
Object.entries(arrayExtensions).forEach(function (_ref) {
|
|
5439
5575
|
var prop = _ref[0],
|
|
5440
5576
|
fn = _ref[1];
|