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
|
@@ -266,100 +266,88 @@ var getOwnPropertyDescriptors = Object.getOwnPropertyDescriptors || function get
|
|
|
266
266
|
});
|
|
267
267
|
return res;
|
|
268
268
|
};
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
for (var i = 0; i < props.length; i++) {
|
|
272
|
-
var descriptor = props[i];
|
|
273
|
-
descriptor.enumerable = descriptor.enumerable || false;
|
|
274
|
-
descriptor.configurable = true;
|
|
275
|
-
if ("value" in descriptor) descriptor.writable = true;
|
|
276
|
-
Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
function _createClass(Constructor, protoProps, staticProps) {
|
|
280
|
-
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
281
|
-
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
282
|
-
Object.defineProperty(Constructor, "prototype", {
|
|
283
|
-
writable: false
|
|
284
|
-
});
|
|
285
|
-
return Constructor;
|
|
286
|
-
}
|
|
287
|
-
function _extends() {
|
|
288
|
-
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
289
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
290
|
-
var source = arguments[i];
|
|
291
|
-
for (var key in source) {
|
|
292
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
293
|
-
target[key] = source[key];
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
return target;
|
|
298
|
-
};
|
|
299
|
-
return _extends.apply(this, arguments);
|
|
269
|
+
function getFlag(flags, mask) {
|
|
270
|
+
return !!(flags & mask);
|
|
300
271
|
}
|
|
301
|
-
function
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
272
|
+
function setFlag(flags, mask, newValue) {
|
|
273
|
+
if (newValue) {
|
|
274
|
+
flags |= mask;
|
|
275
|
+
} else {
|
|
276
|
+
flags &= ~mask;
|
|
277
|
+
}
|
|
278
|
+
return flags;
|
|
305
279
|
}
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
if (
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
330
|
-
return arr2;
|
|
331
|
-
}
|
|
332
|
-
function _createForOfIteratorHelperLoose(o, allowArrayLike) {
|
|
333
|
-
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
|
334
|
-
if (it) return (it = it.call(o)).next.bind(it);
|
|
335
|
-
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
|
|
336
|
-
if (it) o = it;
|
|
337
|
-
var i = 0;
|
|
280
|
+
|
|
281
|
+
function _arrayLikeToArray(r, a) {
|
|
282
|
+
(null == a || a > r.length) && (a = r.length);
|
|
283
|
+
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
284
|
+
return n;
|
|
285
|
+
}
|
|
286
|
+
function _defineProperties(e, r) {
|
|
287
|
+
for (var t = 0; t < r.length; t++) {
|
|
288
|
+
var o = r[t];
|
|
289
|
+
o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o);
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
function _createClass(e, r, t) {
|
|
293
|
+
return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", {
|
|
294
|
+
writable: !1
|
|
295
|
+
}), e;
|
|
296
|
+
}
|
|
297
|
+
function _createForOfIteratorHelperLoose(r, e) {
|
|
298
|
+
var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
299
|
+
if (t) return (t = t.call(r)).next.bind(t);
|
|
300
|
+
if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) {
|
|
301
|
+
t && (r = t);
|
|
302
|
+
var o = 0;
|
|
338
303
|
return function () {
|
|
339
|
-
|
|
340
|
-
done:
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
value: o[i++]
|
|
304
|
+
return o >= r.length ? {
|
|
305
|
+
done: !0
|
|
306
|
+
} : {
|
|
307
|
+
done: !1,
|
|
308
|
+
value: r[o++]
|
|
345
309
|
};
|
|
346
310
|
};
|
|
347
311
|
}
|
|
348
312
|
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
349
313
|
}
|
|
350
|
-
function
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
314
|
+
function _extends() {
|
|
315
|
+
return _extends = Object.assign ? Object.assign.bind() : function (n) {
|
|
316
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
317
|
+
var t = arguments[e];
|
|
318
|
+
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
319
|
+
}
|
|
320
|
+
return n;
|
|
321
|
+
}, _extends.apply(null, arguments);
|
|
322
|
+
}
|
|
323
|
+
function _inheritsLoose(t, o) {
|
|
324
|
+
t.prototype = Object.create(o.prototype), t.prototype.constructor = t, _setPrototypeOf(t, o);
|
|
325
|
+
}
|
|
326
|
+
function _setPrototypeOf(t, e) {
|
|
327
|
+
return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
|
|
328
|
+
return t.__proto__ = e, t;
|
|
329
|
+
}, _setPrototypeOf(t, e);
|
|
330
|
+
}
|
|
331
|
+
function _toPrimitive(t, r) {
|
|
332
|
+
if ("object" != typeof t || !t) return t;
|
|
333
|
+
var e = t[Symbol.toPrimitive];
|
|
334
|
+
if (void 0 !== e) {
|
|
335
|
+
var i = e.call(t, r || "default");
|
|
336
|
+
if ("object" != typeof i) return i;
|
|
356
337
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
357
338
|
}
|
|
358
|
-
return (
|
|
339
|
+
return ("string" === r ? String : Number)(t);
|
|
359
340
|
}
|
|
360
|
-
function _toPropertyKey(
|
|
361
|
-
var
|
|
362
|
-
return
|
|
341
|
+
function _toPropertyKey(t) {
|
|
342
|
+
var i = _toPrimitive(t, "string");
|
|
343
|
+
return "symbol" == typeof i ? i : i + "";
|
|
344
|
+
}
|
|
345
|
+
function _unsupportedIterableToArray(r, a) {
|
|
346
|
+
if (r) {
|
|
347
|
+
if ("string" == typeof r) return _arrayLikeToArray(r, a);
|
|
348
|
+
var t = {}.toString.call(r).slice(8, -1);
|
|
349
|
+
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;
|
|
350
|
+
}
|
|
363
351
|
}
|
|
364
352
|
|
|
365
353
|
var storedAnnotationsSymbol = /*#__PURE__*/Symbol("mobx-stored-annotations");
|
|
@@ -432,8 +420,6 @@ function assert20223DecoratorType(context, types) {
|
|
|
432
420
|
|
|
433
421
|
var $mobx = /*#__PURE__*/Symbol("mobx administration");
|
|
434
422
|
var Atom = /*#__PURE__*/function () {
|
|
435
|
-
// for effective unobserving. BaseAtom has true, for extra optimization, so its onBecomeUnobserved never gets called, because it's not needed
|
|
436
|
-
|
|
437
423
|
/**
|
|
438
424
|
* Create a new atom. For debugging purposes it is recommended to give it a name.
|
|
439
425
|
* The onBecomeObserved and onBecomeUnobserved callbacks can be used for resource management.
|
|
@@ -443,17 +429,17 @@ var Atom = /*#__PURE__*/function () {
|
|
|
443
429
|
name_ = "Atom@" + getNextId() ;
|
|
444
430
|
}
|
|
445
431
|
this.name_ = void 0;
|
|
446
|
-
this.
|
|
447
|
-
this.isBeingObserved = false;
|
|
432
|
+
this.flags_ = 0;
|
|
448
433
|
this.observers_ = new Set();
|
|
449
|
-
this.diffValue_ = 0;
|
|
450
434
|
this.lastAccessedBy_ = 0;
|
|
451
435
|
this.lowestObserverState_ = IDerivationState_.NOT_TRACKING_;
|
|
436
|
+
// onBecomeObservedListeners
|
|
452
437
|
this.onBOL = void 0;
|
|
438
|
+
// onBecomeUnobservedListeners
|
|
453
439
|
this.onBUOL = void 0;
|
|
454
440
|
this.name_ = name_;
|
|
455
441
|
}
|
|
456
|
-
//
|
|
442
|
+
// for effective unobserving. BaseAtom has true, for extra optimization, so its onBecomeUnobserved never gets called, because it's not needed
|
|
457
443
|
var _proto = Atom.prototype;
|
|
458
444
|
_proto.onBO = function onBO() {
|
|
459
445
|
if (this.onBOL) {
|
|
@@ -487,8 +473,35 @@ var Atom = /*#__PURE__*/function () {
|
|
|
487
473
|
_proto.toString = function toString() {
|
|
488
474
|
return this.name_;
|
|
489
475
|
};
|
|
490
|
-
return Atom
|
|
476
|
+
return _createClass(Atom, [{
|
|
477
|
+
key: "isBeingObserved",
|
|
478
|
+
get: function get() {
|
|
479
|
+
return getFlag(this.flags_, Atom.isBeingObservedMask_);
|
|
480
|
+
},
|
|
481
|
+
set: function set(newValue) {
|
|
482
|
+
this.flags_ = setFlag(this.flags_, Atom.isBeingObservedMask_, newValue);
|
|
483
|
+
}
|
|
484
|
+
}, {
|
|
485
|
+
key: "isPendingUnobservation",
|
|
486
|
+
get: function get() {
|
|
487
|
+
return getFlag(this.flags_, Atom.isPendingUnobservationMask_);
|
|
488
|
+
},
|
|
489
|
+
set: function set(newValue) {
|
|
490
|
+
this.flags_ = setFlag(this.flags_, Atom.isPendingUnobservationMask_, newValue);
|
|
491
|
+
}
|
|
492
|
+
}, {
|
|
493
|
+
key: "diffValue",
|
|
494
|
+
get: function get() {
|
|
495
|
+
return getFlag(this.flags_, Atom.diffValueMask_) ? 1 : 0;
|
|
496
|
+
},
|
|
497
|
+
set: function set(newValue) {
|
|
498
|
+
this.flags_ = setFlag(this.flags_, Atom.diffValueMask_, newValue === 1 ? true : false);
|
|
499
|
+
}
|
|
500
|
+
}]);
|
|
491
501
|
}();
|
|
502
|
+
Atom.isBeingObservedMask_ = 1;
|
|
503
|
+
Atom.isPendingUnobservationMask_ = 2;
|
|
504
|
+
Atom.diffValueMask_ = 4;
|
|
492
505
|
var isAtom = /*#__PURE__*/createInstanceofPredicate("Atom", Atom);
|
|
493
506
|
function createAtom(name, onBecomeObservedHandler, onBecomeUnobservedHandler) {
|
|
494
507
|
if (onBecomeObservedHandler === void 0) {
|
|
@@ -635,7 +648,6 @@ function make_(adm, key) {
|
|
|
635
648
|
}
|
|
636
649
|
return 0 /* MakeResult.Cancel */;
|
|
637
650
|
}
|
|
638
|
-
|
|
639
651
|
function extend_(adm, key, descriptor, proxyTrap) {
|
|
640
652
|
die("'" + this.annotationType_ + "' can only be used with 'makeObservable'");
|
|
641
653
|
}
|
|
@@ -668,12 +680,10 @@ function make_$1(adm, key, descriptor, source) {
|
|
|
668
680
|
// rest of the proto chain must be annotated already
|
|
669
681
|
return 1 /* MakeResult.Break */;
|
|
670
682
|
}
|
|
671
|
-
|
|
672
683
|
var actionDescriptor = createActionDescriptor(adm, this, key, descriptor, false);
|
|
673
684
|
defineProperty(source, key, actionDescriptor);
|
|
674
685
|
return 2 /* MakeResult.Continue */;
|
|
675
686
|
}
|
|
676
|
-
|
|
677
687
|
function extend_$1(adm, key, descriptor, proxyTrap) {
|
|
678
688
|
var actionDescriptor = createActionDescriptor(adm, this, key, descriptor);
|
|
679
689
|
return adm.defineProperty_(key, actionDescriptor, proxyTrap);
|
|
@@ -771,18 +781,15 @@ function make_$2(adm, key, descriptor, source) {
|
|
|
771
781
|
return 0 /* MakeResult.Cancel */;
|
|
772
782
|
}
|
|
773
783
|
}
|
|
774
|
-
|
|
775
784
|
if (isFlow(descriptor.value)) {
|
|
776
785
|
// A prototype could have been annotated already by other constructor,
|
|
777
786
|
// rest of the proto chain must be annotated already
|
|
778
787
|
return 1 /* MakeResult.Break */;
|
|
779
788
|
}
|
|
780
|
-
|
|
781
789
|
var flowDescriptor = createFlowDescriptor(adm, this, key, descriptor, false, false);
|
|
782
790
|
defineProperty(source, key, flowDescriptor);
|
|
783
791
|
return 2 /* MakeResult.Continue */;
|
|
784
792
|
}
|
|
785
|
-
|
|
786
793
|
function extend_$2(adm, key, descriptor, proxyTrap) {
|
|
787
794
|
var _this$options_2;
|
|
788
795
|
var flowDescriptor = createFlowDescriptor(adm, this, key, descriptor, (_this$options_2 = this.options_) == null ? void 0 : _this$options_2.bound);
|
|
@@ -859,7 +866,6 @@ function createComputedAnnotation(name, options) {
|
|
|
859
866
|
function make_$3(adm, key, descriptor) {
|
|
860
867
|
return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 1 /* MakeResult.Break */;
|
|
861
868
|
}
|
|
862
|
-
|
|
863
869
|
function extend_$3(adm, key, descriptor, proxyTrap) {
|
|
864
870
|
assertComputedDescriptor(adm, this, key, descriptor);
|
|
865
871
|
return adm.defineComputedProperty_(key, _extends({}, this.options_, {
|
|
@@ -907,7 +913,6 @@ function createObservableAnnotation(name, options) {
|
|
|
907
913
|
function make_$4(adm, key, descriptor) {
|
|
908
914
|
return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 1 /* MakeResult.Break */;
|
|
909
915
|
}
|
|
910
|
-
|
|
911
916
|
function extend_$4(adm, key, descriptor, proxyTrap) {
|
|
912
917
|
var _this$options_$enhanc, _this$options_;
|
|
913
918
|
assertObservableDescriptor(adm, this, key, descriptor);
|
|
@@ -1327,11 +1332,8 @@ function allowStateChangesEnd(prev) {
|
|
|
1327
1332
|
globalState.allowStateChanges = prev;
|
|
1328
1333
|
}
|
|
1329
1334
|
|
|
1330
|
-
var _Symbol$toPrimitive;
|
|
1331
1335
|
var CREATE = "create";
|
|
1332
|
-
_Symbol$toPrimitive = Symbol.toPrimitive;
|
|
1333
1336
|
var ObservableValue = /*#__PURE__*/function (_Atom) {
|
|
1334
|
-
_inheritsLoose(ObservableValue, _Atom);
|
|
1335
1337
|
function ObservableValue(value, enhancer, name_, notifySpy, equals) {
|
|
1336
1338
|
var _this;
|
|
1337
1339
|
if (name_ === void 0) {
|
|
@@ -1360,7 +1362,7 @@ var ObservableValue = /*#__PURE__*/function (_Atom) {
|
|
|
1360
1362
|
// only notify spy if this is a stand-alone observable
|
|
1361
1363
|
spyReport({
|
|
1362
1364
|
type: CREATE,
|
|
1363
|
-
object:
|
|
1365
|
+
object: _this,
|
|
1364
1366
|
observableKind: "value",
|
|
1365
1367
|
debugObjectName: _this.name_,
|
|
1366
1368
|
newValue: "" + _this.value_
|
|
@@ -1368,6 +1370,7 @@ var ObservableValue = /*#__PURE__*/function (_Atom) {
|
|
|
1368
1370
|
}
|
|
1369
1371
|
return _this;
|
|
1370
1372
|
}
|
|
1373
|
+
_inheritsLoose(ObservableValue, _Atom);
|
|
1371
1374
|
var _proto = ObservableValue.prototype;
|
|
1372
1375
|
_proto.dehanceValue = function dehanceValue(value) {
|
|
1373
1376
|
if (this.dehancer !== undefined) {
|
|
@@ -1459,25 +1462,13 @@ var ObservableValue = /*#__PURE__*/function (_Atom) {
|
|
|
1459
1462
|
_proto.valueOf = function valueOf() {
|
|
1460
1463
|
return toPrimitive(this.get());
|
|
1461
1464
|
};
|
|
1462
|
-
_proto[
|
|
1465
|
+
_proto[Symbol.toPrimitive] = function () {
|
|
1463
1466
|
return this.valueOf();
|
|
1464
1467
|
};
|
|
1465
1468
|
return ObservableValue;
|
|
1466
1469
|
}(Atom);
|
|
1467
1470
|
var isObservableValue = /*#__PURE__*/createInstanceofPredicate("ObservableValue", ObservableValue);
|
|
1468
1471
|
|
|
1469
|
-
var _Symbol$toPrimitive$1;
|
|
1470
|
-
function getFlag(flags, mask) {
|
|
1471
|
-
return !!(flags & mask);
|
|
1472
|
-
}
|
|
1473
|
-
function setFlag(flags, mask, newValue) {
|
|
1474
|
-
if (newValue) {
|
|
1475
|
-
flags |= mask;
|
|
1476
|
-
} else {
|
|
1477
|
-
flags &= ~mask;
|
|
1478
|
-
}
|
|
1479
|
-
return flags;
|
|
1480
|
-
}
|
|
1481
1472
|
/**
|
|
1482
1473
|
* A node in the state dependency root that observes other nodes, and can be observed itself.
|
|
1483
1474
|
*
|
|
@@ -1497,13 +1488,7 @@ function setFlag(flags, mask, newValue) {
|
|
|
1497
1488
|
*
|
|
1498
1489
|
* If at any point it's outside batch and it isn't observed: reset everything and go to 1.
|
|
1499
1490
|
*/
|
|
1500
|
-
_Symbol$toPrimitive$1 = Symbol.toPrimitive;
|
|
1501
1491
|
var ComputedValue = /*#__PURE__*/function () {
|
|
1502
|
-
// nodes we are looking at. Our value depends on these nodes
|
|
1503
|
-
// during tracking it's an array with new observed observers
|
|
1504
|
-
|
|
1505
|
-
// N.B: unminified as it is used by MST
|
|
1506
|
-
|
|
1507
1492
|
/**
|
|
1508
1493
|
* Create a new computed value based on a function expression.
|
|
1509
1494
|
*
|
|
@@ -1519,9 +1504,10 @@ var ComputedValue = /*#__PURE__*/function () {
|
|
|
1519
1504
|
function ComputedValue(options) {
|
|
1520
1505
|
this.dependenciesState_ = IDerivationState_.NOT_TRACKING_;
|
|
1521
1506
|
this.observing_ = [];
|
|
1507
|
+
// nodes we are looking at. Our value depends on these nodes
|
|
1522
1508
|
this.newObserving_ = null;
|
|
1509
|
+
// during tracking it's an array with new observed observers
|
|
1523
1510
|
this.observers_ = new Set();
|
|
1524
|
-
this.diffValue_ = 0;
|
|
1525
1511
|
this.runId_ = 0;
|
|
1526
1512
|
this.lastAccessedBy_ = 0;
|
|
1527
1513
|
this.lowestObserverState_ = IDerivationState_.UP_TO_DATE_;
|
|
@@ -1531,6 +1517,7 @@ var ComputedValue = /*#__PURE__*/function () {
|
|
|
1531
1517
|
this.triggeredBy_ = void 0;
|
|
1532
1518
|
this.flags_ = 0;
|
|
1533
1519
|
this.derivation = void 0;
|
|
1520
|
+
// N.B: unminified as it is used by MST
|
|
1534
1521
|
this.setter_ = void 0;
|
|
1535
1522
|
this.isTracing_ = TraceMode.NONE;
|
|
1536
1523
|
this.scope_ = void 0;
|
|
@@ -1712,10 +1699,10 @@ var ComputedValue = /*#__PURE__*/function () {
|
|
|
1712
1699
|
_proto.valueOf = function valueOf() {
|
|
1713
1700
|
return toPrimitive(this.get());
|
|
1714
1701
|
};
|
|
1715
|
-
_proto[
|
|
1702
|
+
_proto[Symbol.toPrimitive] = function () {
|
|
1716
1703
|
return this.valueOf();
|
|
1717
1704
|
};
|
|
1718
|
-
_createClass(ComputedValue, [{
|
|
1705
|
+
return _createClass(ComputedValue, [{
|
|
1719
1706
|
key: "isComputing",
|
|
1720
1707
|
get: function get() {
|
|
1721
1708
|
return getFlag(this.flags_, ComputedValue.isComputingMask_);
|
|
@@ -1747,13 +1734,21 @@ var ComputedValue = /*#__PURE__*/function () {
|
|
|
1747
1734
|
set: function set(newValue) {
|
|
1748
1735
|
this.flags_ = setFlag(this.flags_, ComputedValue.isPendingUnobservationMask_, newValue);
|
|
1749
1736
|
}
|
|
1737
|
+
}, {
|
|
1738
|
+
key: "diffValue",
|
|
1739
|
+
get: function get() {
|
|
1740
|
+
return getFlag(this.flags_, ComputedValue.diffValueMask_) ? 1 : 0;
|
|
1741
|
+
},
|
|
1742
|
+
set: function set(newValue) {
|
|
1743
|
+
this.flags_ = setFlag(this.flags_, ComputedValue.diffValueMask_, newValue === 1 ? true : false);
|
|
1744
|
+
}
|
|
1750
1745
|
}]);
|
|
1751
|
-
return ComputedValue;
|
|
1752
1746
|
}();
|
|
1753
1747
|
ComputedValue.isComputingMask_ = 1;
|
|
1754
1748
|
ComputedValue.isRunningSetterMask_ = 2;
|
|
1755
1749
|
ComputedValue.isBeingObservedMask_ = 4;
|
|
1756
1750
|
ComputedValue.isPendingUnobservationMask_ = 8;
|
|
1751
|
+
ComputedValue.diffValueMask_ = 16;
|
|
1757
1752
|
var isComputedValue = /*#__PURE__*/createInstanceofPredicate("ComputedValue", ComputedValue);
|
|
1758
1753
|
|
|
1759
1754
|
var IDerivationState_;
|
|
@@ -1787,7 +1782,6 @@ var CaughtException = function CaughtException(cause) {
|
|
|
1787
1782
|
this.cause = cause;
|
|
1788
1783
|
// Empty
|
|
1789
1784
|
};
|
|
1790
|
-
|
|
1791
1785
|
function isCaughtException(e) {
|
|
1792
1786
|
return e instanceof CaughtException;
|
|
1793
1787
|
}
|
|
@@ -1851,7 +1845,6 @@ function shouldCompute(derivation) {
|
|
|
1851
1845
|
function isComputingDerivation() {
|
|
1852
1846
|
return globalState.trackingDerivation !== null; // filter out actions inside computations
|
|
1853
1847
|
}
|
|
1854
|
-
|
|
1855
1848
|
function checkIfStateModificationsAreAllowed(atom) {
|
|
1856
1849
|
var hasObservers = atom.observers_.size > 0;
|
|
1857
1850
|
// Should not be possible to change observed state outside strict mode, except during initialization, see #563
|
|
@@ -1924,8 +1917,8 @@ function bindDependencies(derivation) {
|
|
|
1924
1917
|
l = derivation.unboundDepsCount_;
|
|
1925
1918
|
for (var i = 0; i < l; i++) {
|
|
1926
1919
|
var dep = observing[i];
|
|
1927
|
-
if (dep.
|
|
1928
|
-
dep.
|
|
1920
|
+
if (dep.diffValue === 0) {
|
|
1921
|
+
dep.diffValue = 1;
|
|
1929
1922
|
if (i0 !== i) {
|
|
1930
1923
|
observing[i0] = dep;
|
|
1931
1924
|
}
|
|
@@ -1945,18 +1938,18 @@ function bindDependencies(derivation) {
|
|
|
1945
1938
|
l = prevObserving.length;
|
|
1946
1939
|
while (l--) {
|
|
1947
1940
|
var _dep = prevObserving[l];
|
|
1948
|
-
if (_dep.
|
|
1941
|
+
if (_dep.diffValue === 0) {
|
|
1949
1942
|
removeObserver(_dep, derivation);
|
|
1950
1943
|
}
|
|
1951
|
-
_dep.
|
|
1944
|
+
_dep.diffValue = 0;
|
|
1952
1945
|
}
|
|
1953
1946
|
// Go through all new observables and check diffValue: (now it should be unique)
|
|
1954
1947
|
// 0: it was set to 0 in last loop. don't need to do anything.
|
|
1955
1948
|
// 1: it wasn't observed, let's observe it. set back to 0
|
|
1956
1949
|
while (i0--) {
|
|
1957
1950
|
var _dep2 = observing[i0];
|
|
1958
|
-
if (_dep2.
|
|
1959
|
-
_dep2.
|
|
1951
|
+
if (_dep2.diffValue === 1) {
|
|
1952
|
+
_dep2.diffValue = 0;
|
|
1960
1953
|
addObserver(_dep2, derivation);
|
|
1961
1954
|
}
|
|
1962
1955
|
}
|
|
@@ -2022,28 +2015,113 @@ function changeDependenciesStateTo0(derivation) {
|
|
|
2022
2015
|
*/
|
|
2023
2016
|
var persistentKeys = ["mobxGuid", "spyListeners", "enforceActions", "computedRequiresReaction", "reactionRequiresObservable", "observableRequiresReaction", "allowStateReads", "disableErrorBoundaries", "runId", "UNCHANGED", "useProxies"];
|
|
2024
2017
|
var MobXGlobals = function MobXGlobals() {
|
|
2018
|
+
/**
|
|
2019
|
+
* MobXGlobals version.
|
|
2020
|
+
* MobX compatiblity with other versions loaded in memory as long as this version matches.
|
|
2021
|
+
* It indicates that the global state still stores similar information
|
|
2022
|
+
*
|
|
2023
|
+
* N.B: this version is unrelated to the package version of MobX, and is only the version of the
|
|
2024
|
+
* internal state storage of MobX, and can be the same across many different package versions
|
|
2025
|
+
*/
|
|
2025
2026
|
this.version = 6;
|
|
2027
|
+
/**
|
|
2028
|
+
* globally unique token to signal unchanged
|
|
2029
|
+
*/
|
|
2026
2030
|
this.UNCHANGED = {};
|
|
2031
|
+
/**
|
|
2032
|
+
* Currently running derivation
|
|
2033
|
+
*/
|
|
2027
2034
|
this.trackingDerivation = null;
|
|
2035
|
+
/**
|
|
2036
|
+
* Currently running reaction. This determines if we currently have a reactive context.
|
|
2037
|
+
* (Tracking derivation is also set for temporal tracking of computed values inside actions,
|
|
2038
|
+
* but trackingReaction can only be set by a form of Reaction)
|
|
2039
|
+
*/
|
|
2028
2040
|
this.trackingContext = null;
|
|
2041
|
+
/**
|
|
2042
|
+
* Each time a derivation is tracked, it is assigned a unique run-id
|
|
2043
|
+
*/
|
|
2029
2044
|
this.runId = 0;
|
|
2045
|
+
/**
|
|
2046
|
+
* 'guid' for general purpose. Will be persisted amongst resets.
|
|
2047
|
+
*/
|
|
2030
2048
|
this.mobxGuid = 0;
|
|
2049
|
+
/**
|
|
2050
|
+
* Are we in a batch block? (and how many of them)
|
|
2051
|
+
*/
|
|
2031
2052
|
this.inBatch = 0;
|
|
2053
|
+
/**
|
|
2054
|
+
* Observables that don't have observers anymore, and are about to be
|
|
2055
|
+
* suspended, unless somebody else accesses it in the same batch
|
|
2056
|
+
*
|
|
2057
|
+
* @type {IObservable[]}
|
|
2058
|
+
*/
|
|
2032
2059
|
this.pendingUnobservations = [];
|
|
2060
|
+
/**
|
|
2061
|
+
* List of scheduled, not yet executed, reactions.
|
|
2062
|
+
*/
|
|
2033
2063
|
this.pendingReactions = [];
|
|
2064
|
+
/**
|
|
2065
|
+
* Are we currently processing reactions?
|
|
2066
|
+
*/
|
|
2034
2067
|
this.isRunningReactions = false;
|
|
2068
|
+
/**
|
|
2069
|
+
* Is it allowed to change observables at this point?
|
|
2070
|
+
* In general, MobX doesn't allow that when running computations and React.render.
|
|
2071
|
+
* To ensure that those functions stay pure.
|
|
2072
|
+
*/
|
|
2035
2073
|
this.allowStateChanges = false;
|
|
2074
|
+
/**
|
|
2075
|
+
* Is it allowed to read observables at this point?
|
|
2076
|
+
* Used to hold the state needed for `observableRequiresReaction`
|
|
2077
|
+
*/
|
|
2036
2078
|
this.allowStateReads = true;
|
|
2079
|
+
/**
|
|
2080
|
+
* If strict mode is enabled, state changes are by default not allowed
|
|
2081
|
+
*/
|
|
2037
2082
|
this.enforceActions = true;
|
|
2083
|
+
/**
|
|
2084
|
+
* Spy callbacks
|
|
2085
|
+
*/
|
|
2038
2086
|
this.spyListeners = [];
|
|
2087
|
+
/**
|
|
2088
|
+
* Globally attached error handlers that react specifically to errors in reactions
|
|
2089
|
+
*/
|
|
2039
2090
|
this.globalReactionErrorHandlers = [];
|
|
2091
|
+
/**
|
|
2092
|
+
* Warn if computed values are accessed outside a reactive context
|
|
2093
|
+
*/
|
|
2040
2094
|
this.computedRequiresReaction = false;
|
|
2095
|
+
/**
|
|
2096
|
+
* (Experimental)
|
|
2097
|
+
* Warn if you try to create to derivation / reactive context without accessing any observable.
|
|
2098
|
+
*/
|
|
2041
2099
|
this.reactionRequiresObservable = false;
|
|
2100
|
+
/**
|
|
2101
|
+
* (Experimental)
|
|
2102
|
+
* Warn if observables are accessed outside a reactive context
|
|
2103
|
+
*/
|
|
2042
2104
|
this.observableRequiresReaction = false;
|
|
2105
|
+
/*
|
|
2106
|
+
* Don't catch and rethrow exceptions. This is useful for inspecting the state of
|
|
2107
|
+
* the stack when an exception occurs while debugging.
|
|
2108
|
+
*/
|
|
2043
2109
|
this.disableErrorBoundaries = false;
|
|
2110
|
+
/*
|
|
2111
|
+
* If true, we are already handling an exception in an action. Any errors in reactions should be suppressed, as
|
|
2112
|
+
* they are not the cause, see: https://github.com/mobxjs/mobx/issues/1836
|
|
2113
|
+
*/
|
|
2044
2114
|
this.suppressReactionErrors = false;
|
|
2045
2115
|
this.useProxies = true;
|
|
2116
|
+
/*
|
|
2117
|
+
* print warnings about code that would fail if proxies weren't available
|
|
2118
|
+
*/
|
|
2046
2119
|
this.verifyProxies = false;
|
|
2120
|
+
/**
|
|
2121
|
+
* False forces all object's descriptors to
|
|
2122
|
+
* writable: true
|
|
2123
|
+
* configurable: true
|
|
2124
|
+
*/
|
|
2047
2125
|
this.safeDescriptors = true;
|
|
2048
2126
|
};
|
|
2049
2127
|
var canMergeGlobalState = true;
|
|
@@ -2140,7 +2218,6 @@ function addObserver(observable, node) {
|
|
|
2140
2218
|
// invariantObservers(observable);
|
|
2141
2219
|
// invariant(observable._observers.indexOf(node) !== -1, "INTERNAL ERROR didn't add node");
|
|
2142
2220
|
}
|
|
2143
|
-
|
|
2144
2221
|
function removeObserver(observable, node) {
|
|
2145
2222
|
// invariant(globalState.inBatch > 0, "INTERNAL ERROR, remove should be called only inside batch");
|
|
2146
2223
|
// invariant(observable._observers.indexOf(node) !== -1, "INTERNAL ERROR remove already removed node");
|
|
@@ -2153,7 +2230,6 @@ function removeObserver(observable, node) {
|
|
|
2153
2230
|
// invariantObservers(observable);
|
|
2154
2231
|
// invariant(observable._observers.indexOf(node) === -1, "INTERNAL ERROR remove already removed node2");
|
|
2155
2232
|
}
|
|
2156
|
-
|
|
2157
2233
|
function queueForUnobservation(observable) {
|
|
2158
2234
|
if (observable.isPendingUnobservation === false) {
|
|
2159
2235
|
// invariant(observable._observers.length === 0, "INTERNAL ERROR, should only queue for unobservation unobserved observables");
|
|
@@ -2291,7 +2367,6 @@ function propagateMaybeChanged(observable) {
|
|
|
2291
2367
|
});
|
|
2292
2368
|
// invariantLOS(observable, "maybe end");
|
|
2293
2369
|
}
|
|
2294
|
-
|
|
2295
2370
|
function logTraceInfo(derivation, observable) {
|
|
2296
2371
|
console.log("[mobx.trace] '" + derivation.name_ + "' is invalidated due to a change in: '" + observable.name_ + "'");
|
|
2297
2372
|
if (derivation.isTracing_ === TraceMode.BREAK) {
|
|
@@ -2315,8 +2390,6 @@ function printDepTree(tree, lines, depth) {
|
|
|
2315
2390
|
}
|
|
2316
2391
|
|
|
2317
2392
|
var Reaction = /*#__PURE__*/function () {
|
|
2318
|
-
// nodes we are looking at. Our value depends on these nodes
|
|
2319
|
-
|
|
2320
2393
|
function Reaction(name_, onInvalidate_, errorHandler_, requiresObservable_) {
|
|
2321
2394
|
if (name_ === void 0) {
|
|
2322
2395
|
name_ = "Reaction@" + getNextId() ;
|
|
@@ -2326,15 +2399,12 @@ var Reaction = /*#__PURE__*/function () {
|
|
|
2326
2399
|
this.errorHandler_ = void 0;
|
|
2327
2400
|
this.requiresObservable_ = void 0;
|
|
2328
2401
|
this.observing_ = [];
|
|
2402
|
+
// nodes we are looking at. Our value depends on these nodes
|
|
2329
2403
|
this.newObserving_ = [];
|
|
2330
2404
|
this.dependenciesState_ = IDerivationState_.NOT_TRACKING_;
|
|
2331
|
-
this.diffValue_ = 0;
|
|
2332
2405
|
this.runId_ = 0;
|
|
2333
2406
|
this.unboundDepsCount_ = 0;
|
|
2334
|
-
this.
|
|
2335
|
-
this.isScheduled_ = false;
|
|
2336
|
-
this.isTrackPending_ = false;
|
|
2337
|
-
this.isRunning_ = false;
|
|
2407
|
+
this.flags_ = 0;
|
|
2338
2408
|
this.isTracing_ = TraceMode.NONE;
|
|
2339
2409
|
this.name_ = name_;
|
|
2340
2410
|
this.onInvalidate_ = onInvalidate_;
|
|
@@ -2346,29 +2416,26 @@ var Reaction = /*#__PURE__*/function () {
|
|
|
2346
2416
|
this.schedule_();
|
|
2347
2417
|
};
|
|
2348
2418
|
_proto.schedule_ = function schedule_() {
|
|
2349
|
-
if (!this.
|
|
2350
|
-
this.
|
|
2419
|
+
if (!this.isScheduled) {
|
|
2420
|
+
this.isScheduled = true;
|
|
2351
2421
|
globalState.pendingReactions.push(this);
|
|
2352
2422
|
runReactions();
|
|
2353
2423
|
}
|
|
2354
|
-
};
|
|
2355
|
-
_proto.isScheduled = function isScheduled() {
|
|
2356
|
-
return this.isScheduled_;
|
|
2357
2424
|
}
|
|
2358
2425
|
/**
|
|
2359
2426
|
* internal, use schedule() if you intend to kick off a reaction
|
|
2360
2427
|
*/;
|
|
2361
2428
|
_proto.runReaction_ = function runReaction_() {
|
|
2362
|
-
if (!this.
|
|
2429
|
+
if (!this.isDisposed) {
|
|
2363
2430
|
startBatch();
|
|
2364
|
-
this.
|
|
2431
|
+
this.isScheduled = false;
|
|
2365
2432
|
var prev = globalState.trackingContext;
|
|
2366
2433
|
globalState.trackingContext = this;
|
|
2367
2434
|
if (shouldCompute(this)) {
|
|
2368
|
-
this.
|
|
2435
|
+
this.isTrackPending = true;
|
|
2369
2436
|
try {
|
|
2370
2437
|
this.onInvalidate_();
|
|
2371
|
-
if ("development" !== "production" && this.
|
|
2438
|
+
if ("development" !== "production" && this.isTrackPending && isSpyEnabled()) {
|
|
2372
2439
|
// onInvalidate didn't trigger track right away..
|
|
2373
2440
|
spyReport({
|
|
2374
2441
|
name: this.name_,
|
|
@@ -2384,11 +2451,10 @@ var Reaction = /*#__PURE__*/function () {
|
|
|
2384
2451
|
}
|
|
2385
2452
|
};
|
|
2386
2453
|
_proto.track = function track(fn) {
|
|
2387
|
-
if (this.
|
|
2454
|
+
if (this.isDisposed) {
|
|
2388
2455
|
return;
|
|
2389
2456
|
// console.warn("Reaction already disposed") // Note: Not a warning / error in mobx 4 either
|
|
2390
2457
|
}
|
|
2391
|
-
|
|
2392
2458
|
startBatch();
|
|
2393
2459
|
var notify = isSpyEnabled();
|
|
2394
2460
|
var startTime;
|
|
@@ -2399,14 +2465,14 @@ var Reaction = /*#__PURE__*/function () {
|
|
|
2399
2465
|
type: "reaction"
|
|
2400
2466
|
});
|
|
2401
2467
|
}
|
|
2402
|
-
this.
|
|
2468
|
+
this.isRunning = true;
|
|
2403
2469
|
var prevReaction = globalState.trackingContext; // reactions could create reactions...
|
|
2404
2470
|
globalState.trackingContext = this;
|
|
2405
2471
|
var result = trackDerivedFunction(this, fn, undefined);
|
|
2406
2472
|
globalState.trackingContext = prevReaction;
|
|
2407
|
-
this.
|
|
2408
|
-
this.
|
|
2409
|
-
if (this.
|
|
2473
|
+
this.isRunning = false;
|
|
2474
|
+
this.isTrackPending = false;
|
|
2475
|
+
if (this.isDisposed) {
|
|
2410
2476
|
// disposed during last run. Clean up everything that was bound after the dispose call.
|
|
2411
2477
|
clearObserving(this);
|
|
2412
2478
|
}
|
|
@@ -2449,9 +2515,9 @@ var Reaction = /*#__PURE__*/function () {
|
|
|
2449
2515
|
});
|
|
2450
2516
|
};
|
|
2451
2517
|
_proto.dispose = function dispose() {
|
|
2452
|
-
if (!this.
|
|
2453
|
-
this.
|
|
2454
|
-
if (!this.
|
|
2518
|
+
if (!this.isDisposed) {
|
|
2519
|
+
this.isDisposed = true;
|
|
2520
|
+
if (!this.isRunning) {
|
|
2455
2521
|
// if disposed while running, clean up later. Maybe not optimal, but rare case
|
|
2456
2522
|
startBatch();
|
|
2457
2523
|
clearObserving(this);
|
|
@@ -2463,9 +2529,9 @@ var Reaction = /*#__PURE__*/function () {
|
|
|
2463
2529
|
var _this2 = this;
|
|
2464
2530
|
var dispose = function dispose() {
|
|
2465
2531
|
_this2.dispose();
|
|
2466
|
-
abortSignal == null
|
|
2532
|
+
abortSignal == null || abortSignal.removeEventListener == null || abortSignal.removeEventListener("abort", dispose);
|
|
2467
2533
|
};
|
|
2468
|
-
abortSignal == null
|
|
2534
|
+
abortSignal == null || abortSignal.addEventListener == null || abortSignal.addEventListener("abort", dispose);
|
|
2469
2535
|
dispose[$mobx] = this;
|
|
2470
2536
|
return dispose;
|
|
2471
2537
|
};
|
|
@@ -2478,8 +2544,53 @@ var Reaction = /*#__PURE__*/function () {
|
|
|
2478
2544
|
}
|
|
2479
2545
|
trace(this, enterBreakPoint);
|
|
2480
2546
|
};
|
|
2481
|
-
return Reaction
|
|
2547
|
+
return _createClass(Reaction, [{
|
|
2548
|
+
key: "isDisposed",
|
|
2549
|
+
get: function get() {
|
|
2550
|
+
return getFlag(this.flags_, Reaction.isDisposedMask_);
|
|
2551
|
+
},
|
|
2552
|
+
set: function set(newValue) {
|
|
2553
|
+
this.flags_ = setFlag(this.flags_, Reaction.isDisposedMask_, newValue);
|
|
2554
|
+
}
|
|
2555
|
+
}, {
|
|
2556
|
+
key: "isScheduled",
|
|
2557
|
+
get: function get() {
|
|
2558
|
+
return getFlag(this.flags_, Reaction.isScheduledMask_);
|
|
2559
|
+
},
|
|
2560
|
+
set: function set(newValue) {
|
|
2561
|
+
this.flags_ = setFlag(this.flags_, Reaction.isScheduledMask_, newValue);
|
|
2562
|
+
}
|
|
2563
|
+
}, {
|
|
2564
|
+
key: "isTrackPending",
|
|
2565
|
+
get: function get() {
|
|
2566
|
+
return getFlag(this.flags_, Reaction.isTrackPendingMask_);
|
|
2567
|
+
},
|
|
2568
|
+
set: function set(newValue) {
|
|
2569
|
+
this.flags_ = setFlag(this.flags_, Reaction.isTrackPendingMask_, newValue);
|
|
2570
|
+
}
|
|
2571
|
+
}, {
|
|
2572
|
+
key: "isRunning",
|
|
2573
|
+
get: function get() {
|
|
2574
|
+
return getFlag(this.flags_, Reaction.isRunningMask_);
|
|
2575
|
+
},
|
|
2576
|
+
set: function set(newValue) {
|
|
2577
|
+
this.flags_ = setFlag(this.flags_, Reaction.isRunningMask_, newValue);
|
|
2578
|
+
}
|
|
2579
|
+
}, {
|
|
2580
|
+
key: "diffValue",
|
|
2581
|
+
get: function get() {
|
|
2582
|
+
return getFlag(this.flags_, Reaction.diffValueMask_) ? 1 : 0;
|
|
2583
|
+
},
|
|
2584
|
+
set: function set(newValue) {
|
|
2585
|
+
this.flags_ = setFlag(this.flags_, Reaction.diffValueMask_, newValue === 1 ? true : false);
|
|
2586
|
+
}
|
|
2587
|
+
}]);
|
|
2482
2588
|
}();
|
|
2589
|
+
Reaction.isDisposedMask_ = 1;
|
|
2590
|
+
Reaction.isScheduledMask_ = 2;
|
|
2591
|
+
Reaction.isTrackPendingMask_ = 4;
|
|
2592
|
+
Reaction.isRunningMask_ = 8;
|
|
2593
|
+
Reaction.diffValueMask_ = 16;
|
|
2483
2594
|
function onReactionError(handler) {
|
|
2484
2595
|
globalState.globalReactionErrorHandlers.push(handler);
|
|
2485
2596
|
return function () {
|
|
@@ -2517,7 +2628,6 @@ function runReactionsHelper() {
|
|
|
2517
2628
|
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]) );
|
|
2518
2629
|
allReactions.splice(0); // clear reactions
|
|
2519
2630
|
}
|
|
2520
|
-
|
|
2521
2631
|
var remainingReactions = allReactions.splice(0);
|
|
2522
2632
|
for (var i = 0, l = remainingReactions.length; i < l; i++) {
|
|
2523
2633
|
remainingReactions[i].runReaction_();
|
|
@@ -2645,7 +2755,7 @@ function isAction(thing) {
|
|
|
2645
2755
|
* @returns disposer function, which can be used to stop the view from being updated in the future.
|
|
2646
2756
|
*/
|
|
2647
2757
|
function autorun(view, opts) {
|
|
2648
|
-
var _opts$name, _opts, _opts2,
|
|
2758
|
+
var _opts$name, _opts, _opts2, _opts3;
|
|
2649
2759
|
if (opts === void 0) {
|
|
2650
2760
|
opts = EMPTY_OBJECT;
|
|
2651
2761
|
}
|
|
@@ -2674,7 +2784,7 @@ function autorun(view, opts) {
|
|
|
2674
2784
|
isScheduled = true;
|
|
2675
2785
|
scheduler(function () {
|
|
2676
2786
|
isScheduled = false;
|
|
2677
|
-
if (!reaction.
|
|
2787
|
+
if (!reaction.isDisposed) {
|
|
2678
2788
|
reaction.track(reactionRunner);
|
|
2679
2789
|
}
|
|
2680
2790
|
});
|
|
@@ -2684,7 +2794,7 @@ function autorun(view, opts) {
|
|
|
2684
2794
|
function reactionRunner() {
|
|
2685
2795
|
view(reaction);
|
|
2686
2796
|
}
|
|
2687
|
-
if (!((_opts2 = opts) != null && (_opts2
|
|
2797
|
+
if (!((_opts2 = opts) != null && (_opts2 = _opts2.signal) != null && _opts2.aborted)) {
|
|
2688
2798
|
reaction.schedule_();
|
|
2689
2799
|
}
|
|
2690
2800
|
return reaction.getDisposer_((_opts3 = opts) == null ? void 0 : _opts3.signal);
|
|
@@ -2698,7 +2808,7 @@ function createSchedulerFromOptions(opts) {
|
|
|
2698
2808
|
} : run;
|
|
2699
2809
|
}
|
|
2700
2810
|
function reaction(expression, effect, opts) {
|
|
2701
|
-
var _opts$name2, _opts4,
|
|
2811
|
+
var _opts$name2, _opts4, _opts5;
|
|
2702
2812
|
if (opts === void 0) {
|
|
2703
2813
|
opts = EMPTY_OBJECT;
|
|
2704
2814
|
}
|
|
@@ -2728,7 +2838,7 @@ function reaction(expression, effect, opts) {
|
|
|
2728
2838
|
}, opts.onError, opts.requiresObservable);
|
|
2729
2839
|
function reactionRunner() {
|
|
2730
2840
|
isScheduled = false;
|
|
2731
|
-
if (r.
|
|
2841
|
+
if (r.isDisposed) {
|
|
2732
2842
|
return;
|
|
2733
2843
|
}
|
|
2734
2844
|
var changed = false;
|
|
@@ -2747,7 +2857,7 @@ function reaction(expression, effect, opts) {
|
|
|
2747
2857
|
}
|
|
2748
2858
|
firstTime = false;
|
|
2749
2859
|
}
|
|
2750
|
-
if (!((_opts4 = opts) != null && (_opts4
|
|
2860
|
+
if (!((_opts4 = opts) != null && (_opts4 = _opts4.signal) != null && _opts4.aborted)) {
|
|
2751
2861
|
r.schedule_();
|
|
2752
2862
|
}
|
|
2753
2863
|
return r.getDisposer_((_opts5 = opts) == null ? void 0 : _opts5.signal);
|
|
@@ -2956,7 +3066,6 @@ var flow = /*#__PURE__*/Object.assign(function flow(arg1, arg2) {
|
|
|
2956
3066
|
}
|
|
2957
3067
|
onFulfilled(undefined); // kick off the process
|
|
2958
3068
|
});
|
|
2959
|
-
|
|
2960
3069
|
promise.cancel = action(name + " - runid: " + runId + " - cancel", function () {
|
|
2961
3070
|
try {
|
|
2962
3071
|
if (pendingPromise) {
|
|
@@ -2974,7 +3083,6 @@ var flow = /*#__PURE__*/Object.assign(function flow(arg1, arg2) {
|
|
|
2974
3083
|
rejector(e); // there could be a throwing finally block
|
|
2975
3084
|
}
|
|
2976
3085
|
});
|
|
2977
|
-
|
|
2978
3086
|
return promise;
|
|
2979
3087
|
};
|
|
2980
3088
|
res.isMobXFlow = true;
|
|
@@ -2989,7 +3097,6 @@ function cancelPromise(promise) {
|
|
|
2989
3097
|
function flowResult(result) {
|
|
2990
3098
|
return result; // just tricking TypeScript :)
|
|
2991
3099
|
}
|
|
2992
|
-
|
|
2993
3100
|
function isFlow(fn) {
|
|
2994
3101
|
return (fn == null ? void 0 : fn.isMobXFlow) === true;
|
|
2995
3102
|
}
|
|
@@ -3358,7 +3465,7 @@ function _when(predicate, effect, opts) {
|
|
|
3358
3465
|
if (typeof opts.timeout === "number") {
|
|
3359
3466
|
var error = new Error("WHEN_TIMEOUT");
|
|
3360
3467
|
timeoutHandle = setTimeout(function () {
|
|
3361
|
-
if (!disposer[$mobx].
|
|
3468
|
+
if (!disposer[$mobx].isDisposed) {
|
|
3362
3469
|
disposer();
|
|
3363
3470
|
if (opts.onError) {
|
|
3364
3471
|
opts.onError(error);
|
|
@@ -3411,10 +3518,10 @@ function whenPromise(predicate, opts) {
|
|
|
3411
3518
|
disposer();
|
|
3412
3519
|
reject(new Error("WHEN_ABORTED"));
|
|
3413
3520
|
};
|
|
3414
|
-
opts == null
|
|
3521
|
+
opts == null || (_opts$signal2 = opts.signal) == null || _opts$signal2.addEventListener == null || _opts$signal2.addEventListener("abort", abort);
|
|
3415
3522
|
})["finally"](function () {
|
|
3416
3523
|
var _opts$signal3;
|
|
3417
|
-
return opts == null
|
|
3524
|
+
return opts == null || (_opts$signal3 = opts.signal) == null || _opts$signal3.removeEventListener == null ? void 0 : _opts$signal3.removeEventListener("abort", abort);
|
|
3418
3525
|
});
|
|
3419
3526
|
res.cancel = cancel;
|
|
3420
3527
|
return res;
|
|
@@ -3631,8 +3738,6 @@ var arrayTraps = {
|
|
|
3631
3738
|
}
|
|
3632
3739
|
};
|
|
3633
3740
|
var ObservableArrayAdministration = /*#__PURE__*/function () {
|
|
3634
|
-
// this is the prop that gets proxied, so can't replace it!
|
|
3635
|
-
|
|
3636
3741
|
function ObservableArrayAdministration(name, enhancer, owned_, legacyMode_) {
|
|
3637
3742
|
if (name === void 0) {
|
|
3638
3743
|
name = "ObservableArray@" + getNextId() ;
|
|
@@ -3641,6 +3746,7 @@ var ObservableArrayAdministration = /*#__PURE__*/function () {
|
|
|
3641
3746
|
this.legacyMode_ = void 0;
|
|
3642
3747
|
this.atom_ = void 0;
|
|
3643
3748
|
this.values_ = [];
|
|
3749
|
+
// this is the prop that gets proxied, so can't replace it!
|
|
3644
3750
|
this.interceptors_ = void 0;
|
|
3645
3751
|
this.changeListeners_ = void 0;
|
|
3646
3752
|
this.enhancer_ = void 0;
|
|
@@ -3761,7 +3867,6 @@ var ObservableArrayAdministration = /*#__PURE__*/function () {
|
|
|
3761
3867
|
var lengthDelta = newItems.length - deleteCount;
|
|
3762
3868
|
this.updateArrayLength_(length, lengthDelta); // checks if internal array wasn't modified
|
|
3763
3869
|
}
|
|
3764
|
-
|
|
3765
3870
|
var res = this.spliceItemsIntoValues_(index, deleteCount, newItems);
|
|
3766
3871
|
if (deleteCount !== 0 || newItems.length !== 0) {
|
|
3767
3872
|
this.notifyArraySplice_(index, newItems, res);
|
|
@@ -3861,6 +3966,7 @@ var ObservableArrayAdministration = /*#__PURE__*/function () {
|
|
|
3861
3966
|
var change = interceptChange(this, {
|
|
3862
3967
|
type: UPDATE,
|
|
3863
3968
|
object: this.proxy_,
|
|
3969
|
+
// since "this" is the real array we need to pass its proxy
|
|
3864
3970
|
index: index,
|
|
3865
3971
|
newValue: newValue
|
|
3866
3972
|
});
|
|
@@ -4076,17 +4182,12 @@ function isObservableArray(thing) {
|
|
|
4076
4182
|
return isObject(thing) && isObservableArrayAdministration(thing[$mobx]);
|
|
4077
4183
|
}
|
|
4078
4184
|
|
|
4079
|
-
var _Symbol$iterator, _Symbol$toStringTag;
|
|
4080
4185
|
var ObservableMapMarker = {};
|
|
4081
4186
|
var ADD = "add";
|
|
4082
4187
|
var DELETE = "delete";
|
|
4083
4188
|
// just extend Map? See also https://gist.github.com/nestharus/13b4d74f2ef4a2f4357dbd3fc23c1e54
|
|
4084
4189
|
// But: https://github.com/mobxjs/mobx/issues/1556
|
|
4085
|
-
_Symbol$iterator = Symbol.iterator;
|
|
4086
|
-
_Symbol$toStringTag = Symbol.toStringTag;
|
|
4087
4190
|
var ObservableMap = /*#__PURE__*/function () {
|
|
4088
|
-
// hasMap, not hashMap >-).
|
|
4089
|
-
|
|
4090
4191
|
function ObservableMap(initialData, enhancer_, name_) {
|
|
4091
4192
|
var _this = this;
|
|
4092
4193
|
if (enhancer_ === void 0) {
|
|
@@ -4100,6 +4201,7 @@ var ObservableMap = /*#__PURE__*/function () {
|
|
|
4100
4201
|
this[$mobx] = ObservableMapMarker;
|
|
4101
4202
|
this.data_ = void 0;
|
|
4102
4203
|
this.hasMap_ = void 0;
|
|
4204
|
+
// hasMap, not hashMap >-).
|
|
4103
4205
|
this.keysAtom_ = void 0;
|
|
4104
4206
|
this.interceptors_ = void 0;
|
|
4105
4207
|
this.changeListeners_ = void 0;
|
|
@@ -4188,7 +4290,7 @@ var ObservableMap = /*#__PURE__*/function () {
|
|
|
4188
4290
|
transaction(function () {
|
|
4189
4291
|
var _this3$hasMap_$get;
|
|
4190
4292
|
_this3.keysAtom_.reportChanged();
|
|
4191
|
-
(_this3$hasMap_$get = _this3.hasMap_.get(key)) == null
|
|
4293
|
+
(_this3$hasMap_$get = _this3.hasMap_.get(key)) == null || _this3$hasMap_$get.setNewValue_(false);
|
|
4192
4294
|
var observable = _this3.data_.get(key);
|
|
4193
4295
|
observable.setNewValue_(undefined);
|
|
4194
4296
|
_this3.data_["delete"](key);
|
|
@@ -4238,7 +4340,7 @@ var ObservableMap = /*#__PURE__*/function () {
|
|
|
4238
4340
|
var observable = new ObservableValue(newValue, _this4.enhancer_, _this4.name_ + "." + stringifyKey(key) , false);
|
|
4239
4341
|
_this4.data_.set(key, observable);
|
|
4240
4342
|
newValue = observable.value_; // value might have been changed
|
|
4241
|
-
(_this4$hasMap_$get = _this4.hasMap_.get(key)) == null
|
|
4343
|
+
(_this4$hasMap_$get = _this4.hasMap_.get(key)) == null || _this4$hasMap_$get.setNewValue_(true);
|
|
4242
4344
|
_this4.keysAtom_.reportChanged();
|
|
4243
4345
|
});
|
|
4244
4346
|
var notifySpy = isSpyEnabled();
|
|
@@ -4307,7 +4409,7 @@ var ObservableMap = /*#__PURE__*/function () {
|
|
|
4307
4409
|
}
|
|
4308
4410
|
});
|
|
4309
4411
|
};
|
|
4310
|
-
_proto[
|
|
4412
|
+
_proto[Symbol.iterator] = function () {
|
|
4311
4413
|
return this.entries();
|
|
4312
4414
|
};
|
|
4313
4415
|
_proto.forEach = function forEach(callback, thisArg) {
|
|
@@ -4461,19 +4563,18 @@ var ObservableMap = /*#__PURE__*/function () {
|
|
|
4461
4563
|
_proto.intercept_ = function intercept_(handler) {
|
|
4462
4564
|
return registerInterceptor(this, handler);
|
|
4463
4565
|
};
|
|
4464
|
-
_createClass(ObservableMap, [{
|
|
4566
|
+
return _createClass(ObservableMap, [{
|
|
4465
4567
|
key: "size",
|
|
4466
4568
|
get: function get() {
|
|
4467
4569
|
this.keysAtom_.reportObserved();
|
|
4468
4570
|
return this.data_.size;
|
|
4469
4571
|
}
|
|
4470
4572
|
}, {
|
|
4471
|
-
key:
|
|
4573
|
+
key: Symbol.toStringTag,
|
|
4472
4574
|
get: function get() {
|
|
4473
4575
|
return "Map";
|
|
4474
4576
|
}
|
|
4475
4577
|
}]);
|
|
4476
|
-
return ObservableMap;
|
|
4477
4578
|
}();
|
|
4478
4579
|
// eslint-disable-next-line
|
|
4479
4580
|
var isObservableMap = /*#__PURE__*/createInstanceofPredicate("ObservableMap", ObservableMap);
|
|
@@ -4493,10 +4594,7 @@ function convertToMap(dataStructure) {
|
|
|
4493
4594
|
}
|
|
4494
4595
|
}
|
|
4495
4596
|
|
|
4496
|
-
var _Symbol$iterator$1, _Symbol$toStringTag$1;
|
|
4497
4597
|
var ObservableSetMarker = {};
|
|
4498
|
-
_Symbol$iterator$1 = Symbol.iterator;
|
|
4499
|
-
_Symbol$toStringTag$1 = Symbol.toStringTag;
|
|
4500
4598
|
var ObservableSet = /*#__PURE__*/function () {
|
|
4501
4599
|
function ObservableSet(initialData, enhancer, name_) {
|
|
4502
4600
|
var _this = this;
|
|
@@ -4567,7 +4665,6 @@ var ObservableSet = /*#__PURE__*/function () {
|
|
|
4567
4665
|
// ideally, value = change.value would be done here, so that values can be
|
|
4568
4666
|
// changed by interceptor. Same applies for other Set and Map api's.
|
|
4569
4667
|
}
|
|
4570
|
-
|
|
4571
4668
|
if (!this.has(value)) {
|
|
4572
4669
|
transaction(function () {
|
|
4573
4670
|
_this3.data_.add(_this3.enhancer_(value, undefined));
|
|
@@ -4673,6 +4770,47 @@ var ObservableSet = /*#__PURE__*/function () {
|
|
|
4673
4770
|
}
|
|
4674
4771
|
});
|
|
4675
4772
|
};
|
|
4773
|
+
_proto.intersection = function intersection(otherSet) {
|
|
4774
|
+
if (isES6Set(otherSet)) {
|
|
4775
|
+
return otherSet.intersection(this);
|
|
4776
|
+
} else {
|
|
4777
|
+
var dehancedSet = new Set(this);
|
|
4778
|
+
return dehancedSet.intersection(otherSet);
|
|
4779
|
+
}
|
|
4780
|
+
};
|
|
4781
|
+
_proto.union = function union(otherSet) {
|
|
4782
|
+
if (isES6Set(otherSet)) {
|
|
4783
|
+
return otherSet.union(this);
|
|
4784
|
+
} else {
|
|
4785
|
+
var dehancedSet = new Set(this);
|
|
4786
|
+
return dehancedSet.union(otherSet);
|
|
4787
|
+
}
|
|
4788
|
+
};
|
|
4789
|
+
_proto.difference = function difference(otherSet) {
|
|
4790
|
+
return new Set(this).difference(otherSet);
|
|
4791
|
+
};
|
|
4792
|
+
_proto.symmetricDifference = function symmetricDifference(otherSet) {
|
|
4793
|
+
if (isES6Set(otherSet)) {
|
|
4794
|
+
return otherSet.symmetricDifference(this);
|
|
4795
|
+
} else {
|
|
4796
|
+
var dehancedSet = new Set(this);
|
|
4797
|
+
return dehancedSet.symmetricDifference(otherSet);
|
|
4798
|
+
}
|
|
4799
|
+
};
|
|
4800
|
+
_proto.isSubsetOf = function isSubsetOf(otherSet) {
|
|
4801
|
+
return new Set(this).isSubsetOf(otherSet);
|
|
4802
|
+
};
|
|
4803
|
+
_proto.isSupersetOf = function isSupersetOf(otherSet) {
|
|
4804
|
+
return new Set(this).isSupersetOf(otherSet);
|
|
4805
|
+
};
|
|
4806
|
+
_proto.isDisjointFrom = function isDisjointFrom(otherSet) {
|
|
4807
|
+
if (isES6Set(otherSet)) {
|
|
4808
|
+
return otherSet.isDisjointFrom(this);
|
|
4809
|
+
} else {
|
|
4810
|
+
var dehancedSet = new Set(this);
|
|
4811
|
+
return dehancedSet.isDisjointFrom(otherSet);
|
|
4812
|
+
}
|
|
4813
|
+
};
|
|
4676
4814
|
_proto.replace = function replace(other) {
|
|
4677
4815
|
var _this5 = this;
|
|
4678
4816
|
if (isObservableSet(other)) {
|
|
@@ -4711,22 +4849,21 @@ var ObservableSet = /*#__PURE__*/function () {
|
|
|
4711
4849
|
_proto.toString = function toString() {
|
|
4712
4850
|
return "[object ObservableSet]";
|
|
4713
4851
|
};
|
|
4714
|
-
_proto[
|
|
4852
|
+
_proto[Symbol.iterator] = function () {
|
|
4715
4853
|
return this.values();
|
|
4716
4854
|
};
|
|
4717
|
-
_createClass(ObservableSet, [{
|
|
4855
|
+
return _createClass(ObservableSet, [{
|
|
4718
4856
|
key: "size",
|
|
4719
4857
|
get: function get() {
|
|
4720
4858
|
this.atom_.reportObserved();
|
|
4721
4859
|
return this.data_.size;
|
|
4722
4860
|
}
|
|
4723
4861
|
}, {
|
|
4724
|
-
key:
|
|
4862
|
+
key: Symbol.toStringTag,
|
|
4725
4863
|
get: function get() {
|
|
4726
4864
|
return "Set";
|
|
4727
4865
|
}
|
|
4728
4866
|
}]);
|
|
4729
|
-
return ObservableSet;
|
|
4730
4867
|
}();
|
|
4731
4868
|
// eslint-disable-next-line
|
|
4732
4869
|
var isObservableSet = /*#__PURE__*/createInstanceofPredicate("ObservableSet", ObservableSet);
|
|
@@ -5126,7 +5263,7 @@ var ObservableObjectAdministration = /*#__PURE__*/function () {
|
|
|
5126
5263
|
}
|
|
5127
5264
|
// Delete
|
|
5128
5265
|
try {
|
|
5129
|
-
var _this$pendingKeys_
|
|
5266
|
+
var _this$pendingKeys_;
|
|
5130
5267
|
startBatch();
|
|
5131
5268
|
var notify = hasListeners(this);
|
|
5132
5269
|
var notifySpy = "development" !== "production" && isSpyEnabled();
|
|
@@ -5164,7 +5301,7 @@ var ObservableObjectAdministration = /*#__PURE__*/function () {
|
|
|
5164
5301
|
this.keysAtom_.reportChanged();
|
|
5165
5302
|
// Notify "has" observers
|
|
5166
5303
|
// "in" as it may still exist in proto
|
|
5167
|
-
(_this$pendingKeys_ = this.pendingKeys_) == null
|
|
5304
|
+
(_this$pendingKeys_ = this.pendingKeys_) == null || (_this$pendingKeys_ = _this$pendingKeys_.get(key)) == null || _this$pendingKeys_.set(key in this.target_);
|
|
5168
5305
|
// Notify spies/listeners
|
|
5169
5306
|
if (notify || notifySpy) {
|
|
5170
5307
|
var _change2 = {
|
|
@@ -5205,7 +5342,7 @@ var ObservableObjectAdministration = /*#__PURE__*/function () {
|
|
|
5205
5342
|
return registerInterceptor(this, handler);
|
|
5206
5343
|
};
|
|
5207
5344
|
_proto.notifyPropertyAddition_ = function notifyPropertyAddition_(key, value) {
|
|
5208
|
-
var _this$pendingKeys_2
|
|
5345
|
+
var _this$pendingKeys_2;
|
|
5209
5346
|
var notify = hasListeners(this);
|
|
5210
5347
|
var notifySpy = isSpyEnabled();
|
|
5211
5348
|
if (notify || notifySpy) {
|
|
@@ -5227,7 +5364,7 @@ var ObservableObjectAdministration = /*#__PURE__*/function () {
|
|
|
5227
5364
|
spyReportEnd();
|
|
5228
5365
|
}
|
|
5229
5366
|
}
|
|
5230
|
-
(_this$pendingKeys_2 = this.pendingKeys_) == null
|
|
5367
|
+
(_this$pendingKeys_2 = this.pendingKeys_) == null || (_this$pendingKeys_2 = _this$pendingKeys_2.get(key)) == null || _this$pendingKeys_2.set(true);
|
|
5231
5368
|
// Notify "keys/entries/values" observers
|
|
5232
5369
|
this.keysAtom_.reportChanged();
|
|
5233
5370
|
};
|
|
@@ -5289,7 +5426,7 @@ function recordAnnotationApplied(adm, annotation, key) {
|
|
|
5289
5426
|
adm.appliedAnnotations_[key] = annotation;
|
|
5290
5427
|
}
|
|
5291
5428
|
// Remove applied decorator annotation so we don't try to apply it again in subclass constructor
|
|
5292
|
-
(_adm$target_$storedAn = adm.target_[storedAnnotationsSymbol]) == null
|
|
5429
|
+
(_adm$target_$storedAn = adm.target_[storedAnnotationsSymbol]) == null || delete _adm$target_$storedAn[key];
|
|
5293
5430
|
}
|
|
5294
5431
|
function assertAnnotable(adm, annotation, key) {
|
|
5295
5432
|
// Valid annotation
|
|
@@ -5369,8 +5506,7 @@ inherit(StubArray, Array.prototype);
|
|
|
5369
5506
|
// Weex proto freeze protection was here,
|
|
5370
5507
|
// but it is unclear why the hack is need as MobX never changed the prototype
|
|
5371
5508
|
// anyway, so removed it in V6
|
|
5372
|
-
var LegacyObservableArray = /*#__PURE__*/function (_StubArray
|
|
5373
|
-
_inheritsLoose(LegacyObservableArray, _StubArray);
|
|
5509
|
+
var LegacyObservableArray = /*#__PURE__*/function (_StubArray) {
|
|
5374
5510
|
function LegacyObservableArray(initialValues, enhancer, name, owned) {
|
|
5375
5511
|
var _this;
|
|
5376
5512
|
if (name === void 0) {
|
|
@@ -5382,8 +5518,8 @@ var LegacyObservableArray = /*#__PURE__*/function (_StubArray, _Symbol$toStringT
|
|
|
5382
5518
|
_this = _StubArray.call(this) || this;
|
|
5383
5519
|
initObservable(function () {
|
|
5384
5520
|
var adm = new ObservableArrayAdministration(name, enhancer, owned, true);
|
|
5385
|
-
adm.proxy_ =
|
|
5386
|
-
addHiddenFinalProp(
|
|
5521
|
+
adm.proxy_ = _this;
|
|
5522
|
+
addHiddenFinalProp(_this, $mobx, adm);
|
|
5387
5523
|
if (initialValues && initialValues.length) {
|
|
5388
5524
|
// @ts-ignore
|
|
5389
5525
|
_this.spliceWithArray(0, 0, initialValues);
|
|
@@ -5391,11 +5527,12 @@ var LegacyObservableArray = /*#__PURE__*/function (_StubArray, _Symbol$toStringT
|
|
|
5391
5527
|
if (safariPrototypeSetterInheritanceBug) {
|
|
5392
5528
|
// Seems that Safari won't use numeric prototype setter until any * numeric property is
|
|
5393
5529
|
// defined on the instance. After that it works fine, even if this property is deleted.
|
|
5394
|
-
Object.defineProperty(
|
|
5530
|
+
Object.defineProperty(_this, "0", ENTRY_0);
|
|
5395
5531
|
}
|
|
5396
5532
|
});
|
|
5397
5533
|
return _this;
|
|
5398
5534
|
}
|
|
5535
|
+
_inheritsLoose(LegacyObservableArray, _StubArray);
|
|
5399
5536
|
var _proto = LegacyObservableArray.prototype;
|
|
5400
5537
|
_proto.concat = function concat() {
|
|
5401
5538
|
this[$mobx].atom_.reportObserved();
|
|
@@ -5408,7 +5545,7 @@ var LegacyObservableArray = /*#__PURE__*/function (_StubArray, _Symbol$toStringT
|
|
|
5408
5545
|
return isObservableArray(a) ? a.slice() : a;
|
|
5409
5546
|
}));
|
|
5410
5547
|
};
|
|
5411
|
-
_proto[
|
|
5548
|
+
_proto[Symbol.iterator] = function () {
|
|
5412
5549
|
var self = this;
|
|
5413
5550
|
var nextIndex = 0;
|
|
5414
5551
|
return makeIterable({
|
|
@@ -5423,7 +5560,7 @@ var LegacyObservableArray = /*#__PURE__*/function (_StubArray, _Symbol$toStringT
|
|
|
5423
5560
|
}
|
|
5424
5561
|
});
|
|
5425
5562
|
};
|
|
5426
|
-
_createClass(LegacyObservableArray, [{
|
|
5563
|
+
return _createClass(LegacyObservableArray, [{
|
|
5427
5564
|
key: "length",
|
|
5428
5565
|
get: function get() {
|
|
5429
5566
|
return this[$mobx].getArrayLength_();
|
|
@@ -5432,13 +5569,12 @@ var LegacyObservableArray = /*#__PURE__*/function (_StubArray, _Symbol$toStringT
|
|
|
5432
5569
|
this[$mobx].setArrayLength_(newLength);
|
|
5433
5570
|
}
|
|
5434
5571
|
}, {
|
|
5435
|
-
key:
|
|
5572
|
+
key: Symbol.toStringTag,
|
|
5436
5573
|
get: function get() {
|
|
5437
5574
|
return "Array";
|
|
5438
5575
|
}
|
|
5439
5576
|
}]);
|
|
5440
|
-
|
|
5441
|
-
}(StubArray, Symbol.toStringTag, Symbol.iterator);
|
|
5577
|
+
}(StubArray);
|
|
5442
5578
|
Object.entries(arrayExtensions).forEach(function (_ref) {
|
|
5443
5579
|
var prop = _ref[0],
|
|
5444
5580
|
fn = _ref[1];
|