@azrico/webobject 1.4.120 → 1.4.122
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.
|
@@ -86,13 +86,21 @@ export declare class SimpleObject extends MapableObject {
|
|
|
86
86
|
setSubValue<MKey extends PropOf<this>>(key: MKey, objKey: string, subvalue: any, sendChanges?: sendChangesType): Promise<boolean>;
|
|
87
87
|
getSubValue: (key: PropOf<this>, subkey: string, original?: boolean) => any;
|
|
88
88
|
/**
|
|
89
|
-
* Push value
|
|
89
|
+
* Push a single value to array property
|
|
90
90
|
* @param key
|
|
91
91
|
* @param value
|
|
92
92
|
* @param sendChanges
|
|
93
93
|
* @returns
|
|
94
94
|
*/
|
|
95
95
|
pushValue<MKey extends PropOf<this>>(key: MKey, value: any, sendChanges?: sendChangesType): Promise<this[MKey] | false>;
|
|
96
|
+
/**
|
|
97
|
+
* Push a list of values to array property
|
|
98
|
+
* @param key
|
|
99
|
+
* @param values
|
|
100
|
+
* @param sendChanges
|
|
101
|
+
* @returns
|
|
102
|
+
*/
|
|
103
|
+
pushValues<MKey extends PropOf<this>>(key: MKey, values: any[], sendChanges?: sendChangesType): Promise<this[MKey] | false>;
|
|
96
104
|
notifyChanged<MKey extends PropOf<this>>(type: string, key: MKey | string, value: any, subvalue?: any): Promise<void>;
|
|
97
105
|
/**
|
|
98
106
|
* check if a key can be changed on an object
|
|
@@ -12,12 +12,6 @@ var _ObjectManager = _interopRequireDefault(require("./ObjectManager"));
|
|
|
12
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
13
13
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
14
14
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
15
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
16
|
-
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
17
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
18
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
19
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
20
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
21
15
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
22
16
|
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
23
17
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
@@ -46,7 +40,7 @@ var _setProperty = /*#__PURE__*/new WeakSet();
|
|
|
46
40
|
var _setDefaultProperty = /*#__PURE__*/new WeakSet();
|
|
47
41
|
var _getProperty = /*#__PURE__*/new WeakSet();
|
|
48
42
|
var _setSaveResultObject = /*#__PURE__*/new WeakSet();
|
|
49
|
-
var SimpleObject = /*#__PURE__*/function (_MapableObject, _setValue, _setTemp, _clearRefreshFunction, _setRefreshFunction, _addRefreshFunction, _runRefreshFunction, _setAll, _setSubValue, _pushValue, _notifyChanged, _reset, _resetAll, _event_run, _event_add, _setTemp2, _delete_cache) {
|
|
43
|
+
var SimpleObject = /*#__PURE__*/function (_MapableObject, _setValue, _setTemp, _clearRefreshFunction, _setRefreshFunction, _addRefreshFunction, _runRefreshFunction, _setAll, _setSubValue, _pushValue, _pushValues, _notifyChanged, _reset, _resetAll, _event_run, _event_add, _setTemp2, _delete_cache) {
|
|
50
44
|
_inherits(SimpleObject, _MapableObject);
|
|
51
45
|
var _super = _createSuper(SimpleObject);
|
|
52
46
|
function SimpleObject() {
|
|
@@ -432,7 +426,7 @@ var SimpleObject = /*#__PURE__*/function (_MapableObject, _setValue, _setTemp, _
|
|
|
432
426
|
key: "pushValue",
|
|
433
427
|
value:
|
|
434
428
|
/**
|
|
435
|
-
* Push value
|
|
429
|
+
* Push a single value to array property
|
|
436
430
|
* @param key
|
|
437
431
|
* @param value
|
|
438
432
|
* @param sendChanges
|
|
@@ -441,69 +435,95 @@ var SimpleObject = /*#__PURE__*/function (_MapableObject, _setValue, _setTemp, _
|
|
|
441
435
|
function pushValue(_x12, _x13) {
|
|
442
436
|
return (_pushValue = _pushValue || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(key, value) {
|
|
443
437
|
var sendChanges,
|
|
444
|
-
tempArray,
|
|
445
438
|
_args9 = arguments;
|
|
446
439
|
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
447
440
|
while (1) switch (_context9.prev = _context9.next) {
|
|
448
441
|
case 0:
|
|
449
442
|
sendChanges = _args9.length > 2 && _args9[2] !== undefined ? _args9[2] : "auto";
|
|
450
|
-
|
|
451
|
-
|
|
443
|
+
_context9.next = 3;
|
|
444
|
+
return this.pushValue(key, [value], sendChanges);
|
|
445
|
+
case 3:
|
|
446
|
+
return _context9.abrupt("return", _context9.sent);
|
|
447
|
+
case 4:
|
|
448
|
+
case "end":
|
|
449
|
+
return _context9.stop();
|
|
450
|
+
}
|
|
451
|
+
}, _callee9, this);
|
|
452
|
+
}))).apply(this, arguments);
|
|
453
|
+
}
|
|
454
|
+
/**
|
|
455
|
+
* Push a list of values to array property
|
|
456
|
+
* @param key
|
|
457
|
+
* @param values
|
|
458
|
+
* @param sendChanges
|
|
459
|
+
* @returns
|
|
460
|
+
*/
|
|
461
|
+
}, {
|
|
462
|
+
key: "pushValues",
|
|
463
|
+
value: function pushValues(_x14, _x15) {
|
|
464
|
+
return (_pushValues = _pushValues || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(key, values) {
|
|
465
|
+
var sendChanges,
|
|
466
|
+
tempArray,
|
|
467
|
+
_args10 = arguments;
|
|
468
|
+
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
469
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
470
|
+
case 0:
|
|
471
|
+
sendChanges = _args10.length > 2 && _args10[2] !== undefined ? _args10[2] : "auto";
|
|
472
|
+
if (!(0, _object.array_isEmpty)(values)) {
|
|
473
|
+
_context10.next = 3;
|
|
452
474
|
break;
|
|
453
475
|
}
|
|
454
|
-
return
|
|
476
|
+
return _context10.abrupt("return", false);
|
|
455
477
|
case 3:
|
|
456
478
|
if (this.canModify) {
|
|
457
|
-
|
|
479
|
+
_context10.next = 9;
|
|
458
480
|
break;
|
|
459
481
|
}
|
|
460
482
|
if (!(this.__throw_errors !== false)) {
|
|
461
|
-
|
|
483
|
+
_context10.next = 8;
|
|
462
484
|
break;
|
|
463
485
|
}
|
|
464
|
-
throw Error("Cant use
|
|
486
|
+
throw Error("Cant use pushValues when on readonly mode");
|
|
465
487
|
case 8:
|
|
466
|
-
return
|
|
488
|
+
return _context10.abrupt("return", false);
|
|
467
489
|
case 9:
|
|
468
|
-
if (_classPrivateMethodGet(this, _getProperty, _getProperty2).call(this, key) == null)
|
|
469
|
-
_classPrivateMethodGet(this, _setProperty, _setProperty2).call(this, key, []);
|
|
470
|
-
}
|
|
490
|
+
if (_classPrivateMethodGet(this, _getProperty, _getProperty2).call(this, key) == null) _classPrivateMethodGet(this, _setProperty, _setProperty2).call(this, key, []);
|
|
471
491
|
tempArray = _classPrivateMethodGet(this, _getProperty, _getProperty2).call(this, key);
|
|
472
492
|
if (Array.isArray(tempArray)) {
|
|
473
|
-
|
|
493
|
+
_context10.next = 17;
|
|
474
494
|
break;
|
|
475
495
|
}
|
|
476
496
|
if (!(this.__throw_errors !== false)) {
|
|
477
|
-
|
|
497
|
+
_context10.next = 16;
|
|
478
498
|
break;
|
|
479
499
|
}
|
|
480
|
-
throw Error("Cant use
|
|
500
|
+
throw Error("Cant use pushValues on non Array keys");
|
|
481
501
|
case 16:
|
|
482
|
-
return
|
|
502
|
+
return _context10.abrupt("return", false);
|
|
483
503
|
case 17:
|
|
484
|
-
_classPrivateMethodGet(this, _setProperty, _setProperty2).call(this, key,
|
|
504
|
+
_classPrivateMethodGet(this, _setProperty, _setProperty2).call(this, key, (0, _object.array_merge)(tempArray, values));
|
|
485
505
|
if (!(sendChanges === true || sendChanges === "auto")) {
|
|
486
|
-
|
|
506
|
+
_context10.next = 21;
|
|
487
507
|
break;
|
|
488
508
|
}
|
|
489
|
-
|
|
490
|
-
return this.notifyChanged("", key,
|
|
509
|
+
_context10.next = 21;
|
|
510
|
+
return this.notifyChanged("", key, values);
|
|
491
511
|
case 21:
|
|
492
|
-
return
|
|
512
|
+
return _context10.abrupt("return", tempArray);
|
|
493
513
|
case 22:
|
|
494
514
|
case "end":
|
|
495
|
-
return
|
|
515
|
+
return _context10.stop();
|
|
496
516
|
}
|
|
497
|
-
},
|
|
517
|
+
}, _callee10, this);
|
|
498
518
|
}))).apply(this, arguments);
|
|
499
519
|
}
|
|
500
520
|
}, {
|
|
501
521
|
key: "notifyChanged",
|
|
502
|
-
value: function notifyChanged(
|
|
503
|
-
return (_notifyChanged = _notifyChanged || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
522
|
+
value: function notifyChanged(_x16, _x17, _x18, _x19) {
|
|
523
|
+
return (_notifyChanged = _notifyChanged || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(type, key, value, subvalue) {
|
|
504
524
|
var lc, manager_class;
|
|
505
|
-
return _regeneratorRuntime().wrap(function
|
|
506
|
-
while (1) switch (
|
|
525
|
+
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
526
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
507
527
|
case 0:
|
|
508
528
|
if (value === undefined && type == "") value = this.getValue(key);
|
|
509
529
|
this.__changed = true;
|
|
@@ -518,16 +538,16 @@ var SimpleObject = /*#__PURE__*/function (_MapableObject, _setValue, _setTemp, _
|
|
|
518
538
|
/* --------------------------- notify the manager --------------------------- */
|
|
519
539
|
manager_class = this.manager;
|
|
520
540
|
if (!(manager_class instanceof _ObjectManager["default"])) {
|
|
521
|
-
|
|
541
|
+
_context11.next = 10;
|
|
522
542
|
break;
|
|
523
543
|
}
|
|
524
|
-
|
|
544
|
+
_context11.next = 10;
|
|
525
545
|
return manager_class.notifyChanged(type, key, value, subvalue);
|
|
526
546
|
case 10:
|
|
527
547
|
case "end":
|
|
528
|
-
return
|
|
548
|
+
return _context11.stop();
|
|
529
549
|
}
|
|
530
|
-
},
|
|
550
|
+
}, _callee11, this);
|
|
531
551
|
}))).apply(this, arguments);
|
|
532
552
|
}
|
|
533
553
|
/**
|
|
@@ -591,23 +611,23 @@ var SimpleObject = /*#__PURE__*/function (_MapableObject, _setValue, _setTemp, _
|
|
|
591
611
|
*/
|
|
592
612
|
}, {
|
|
593
613
|
key: "reset",
|
|
594
|
-
value: function reset(
|
|
595
|
-
return (_reset = _reset || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
614
|
+
value: function reset(_x20) {
|
|
615
|
+
return (_reset = _reset || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(key) {
|
|
596
616
|
var notifyChanged,
|
|
597
|
-
|
|
598
|
-
return _regeneratorRuntime().wrap(function
|
|
599
|
-
while (1) switch (
|
|
617
|
+
_args12 = arguments;
|
|
618
|
+
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
619
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
600
620
|
case 0:
|
|
601
|
-
notifyChanged =
|
|
602
|
-
|
|
621
|
+
notifyChanged = _args12.length > 1 && _args12[1] !== undefined ? _args12[1] : "auto";
|
|
622
|
+
_context12.next = 3;
|
|
603
623
|
return this.setValue(key, this[key], notifyChanged);
|
|
604
624
|
case 3:
|
|
605
|
-
return
|
|
625
|
+
return _context12.abrupt("return", _context12.sent);
|
|
606
626
|
case 4:
|
|
607
627
|
case "end":
|
|
608
|
-
return
|
|
628
|
+
return _context12.stop();
|
|
609
629
|
}
|
|
610
|
-
},
|
|
630
|
+
}, _callee12, this);
|
|
611
631
|
}))).apply(this, arguments);
|
|
612
632
|
}
|
|
613
633
|
/**
|
|
@@ -618,43 +638,43 @@ var SimpleObject = /*#__PURE__*/function (_MapableObject, _setValue, _setTemp, _
|
|
|
618
638
|
}, {
|
|
619
639
|
key: "resetAll",
|
|
620
640
|
value: function resetAll() {
|
|
621
|
-
return (_resetAll = _resetAll || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
641
|
+
return (_resetAll = _resetAll || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
|
|
622
642
|
var notifyChanged,
|
|
623
643
|
fr,
|
|
624
644
|
key,
|
|
625
|
-
|
|
626
|
-
return _regeneratorRuntime().wrap(function
|
|
627
|
-
while (1) switch (
|
|
645
|
+
_args13 = arguments;
|
|
646
|
+
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
647
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
628
648
|
case 0:
|
|
629
|
-
notifyChanged =
|
|
649
|
+
notifyChanged = _args13.length > 0 && _args13[0] !== undefined ? _args13[0] : "auto";
|
|
630
650
|
fr = true;
|
|
631
|
-
|
|
651
|
+
_context13.t0 = _regeneratorRuntime().keys(this.__delta);
|
|
632
652
|
case 3:
|
|
633
|
-
if ((
|
|
634
|
-
|
|
653
|
+
if ((_context13.t1 = _context13.t0()).done) {
|
|
654
|
+
_context13.next = 13;
|
|
635
655
|
break;
|
|
636
656
|
}
|
|
637
|
-
key =
|
|
638
|
-
|
|
639
|
-
if (!
|
|
640
|
-
|
|
657
|
+
key = _context13.t1.value;
|
|
658
|
+
_context13.t2 = fr;
|
|
659
|
+
if (!_context13.t2) {
|
|
660
|
+
_context13.next = 10;
|
|
641
661
|
break;
|
|
642
662
|
}
|
|
643
|
-
|
|
663
|
+
_context13.next = 9;
|
|
644
664
|
return this.reset(key, notifyChanged);
|
|
645
665
|
case 9:
|
|
646
|
-
|
|
666
|
+
_context13.t2 = _context13.sent;
|
|
647
667
|
case 10:
|
|
648
|
-
fr =
|
|
649
|
-
|
|
668
|
+
fr = _context13.t2;
|
|
669
|
+
_context13.next = 3;
|
|
650
670
|
break;
|
|
651
671
|
case 13:
|
|
652
|
-
return
|
|
672
|
+
return _context13.abrupt("return", fr);
|
|
653
673
|
case 14:
|
|
654
674
|
case "end":
|
|
655
|
-
return
|
|
675
|
+
return _context13.stop();
|
|
656
676
|
}
|
|
657
|
-
},
|
|
677
|
+
}, _callee13, this);
|
|
658
678
|
}))).apply(this, arguments);
|
|
659
679
|
}
|
|
660
680
|
/**
|
|
@@ -826,35 +846,35 @@ var SimpleObject = /*#__PURE__*/function (_MapableObject, _setValue, _setTemp, _
|
|
|
826
846
|
/* -------------------------------------------------------------------------- */
|
|
827
847
|
/* Events */
|
|
828
848
|
/* -------------------------------------------------------------------------- */
|
|
829
|
-
function event_run(
|
|
830
|
-
return (_event_run = _event_run || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
849
|
+
function event_run(_x21) {
|
|
850
|
+
return (_event_run = _event_run || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(eventName) {
|
|
831
851
|
var _this$manager;
|
|
832
852
|
var _len2,
|
|
833
853
|
params,
|
|
834
854
|
_key2,
|
|
835
|
-
|
|
836
|
-
return _regeneratorRuntime().wrap(function
|
|
837
|
-
while (1) switch (
|
|
855
|
+
_args14 = arguments;
|
|
856
|
+
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
857
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
838
858
|
case 0:
|
|
839
859
|
if (this.manager) {
|
|
840
|
-
|
|
860
|
+
_context14.next = 3;
|
|
841
861
|
break;
|
|
842
862
|
}
|
|
843
863
|
if (this.__showErrors === true) console.error("you cant use events if your object has no manager");
|
|
844
|
-
return
|
|
864
|
+
return _context14.abrupt("return");
|
|
845
865
|
case 3:
|
|
846
|
-
for (_len2 =
|
|
847
|
-
params[_key2 - 1] =
|
|
866
|
+
for (_len2 = _args14.length, params = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
867
|
+
params[_key2 - 1] = _args14[_key2];
|
|
848
868
|
}
|
|
849
|
-
|
|
869
|
+
_context14.next = 6;
|
|
850
870
|
return (_this$manager = this.manager).event_run.apply(_this$manager, [eventName].concat(params));
|
|
851
871
|
case 6:
|
|
852
|
-
return
|
|
872
|
+
return _context14.abrupt("return", _context14.sent);
|
|
853
873
|
case 7:
|
|
854
874
|
case "end":
|
|
855
|
-
return
|
|
875
|
+
return _context14.stop();
|
|
856
876
|
}
|
|
857
|
-
},
|
|
877
|
+
}, _callee14, this);
|
|
858
878
|
}))).apply(this, arguments);
|
|
859
879
|
}
|
|
860
880
|
}, {
|
|
@@ -879,30 +899,30 @@ var SimpleObject = /*#__PURE__*/function (_MapableObject, _setValue, _setTemp, _
|
|
|
879
899
|
}
|
|
880
900
|
}, {
|
|
881
901
|
key: "event_add",
|
|
882
|
-
value: function event_add(
|
|
883
|
-
return (_event_add = _event_add || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
902
|
+
value: function event_add(_x22, _x23, _x24) {
|
|
903
|
+
return (_event_add = _event_add || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(name, uname, runEvent) {
|
|
884
904
|
var onlyOn,
|
|
885
905
|
runOnce,
|
|
886
|
-
|
|
887
|
-
return _regeneratorRuntime().wrap(function
|
|
888
|
-
while (1) switch (
|
|
906
|
+
_args15 = arguments;
|
|
907
|
+
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
|
908
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
889
909
|
case 0:
|
|
890
|
-
onlyOn =
|
|
891
|
-
runOnce =
|
|
910
|
+
onlyOn = _args15.length > 3 && _args15[3] !== undefined ? _args15[3] : null;
|
|
911
|
+
runOnce = _args15.length > 4 && _args15[4] !== undefined ? _args15[4] : false;
|
|
892
912
|
if (this.manager) {
|
|
893
|
-
|
|
913
|
+
_context15.next = 5;
|
|
894
914
|
break;
|
|
895
915
|
}
|
|
896
916
|
if (this.__showErrors === true) console.error("you cant use events if your object has no manager");
|
|
897
|
-
return
|
|
917
|
+
return _context15.abrupt("return");
|
|
898
918
|
case 5:
|
|
899
|
-
|
|
919
|
+
_context15.next = 7;
|
|
900
920
|
return this.manager.event_add(name, uname, runEvent, onlyOn, runOnce);
|
|
901
921
|
case 7:
|
|
902
922
|
case "end":
|
|
903
|
-
return
|
|
923
|
+
return _context15.stop();
|
|
904
924
|
}
|
|
905
|
-
},
|
|
925
|
+
}, _callee15, this);
|
|
906
926
|
}))).apply(this, arguments);
|
|
907
927
|
}
|
|
908
928
|
/* -------------------------------------------------------------------------- */
|
|
@@ -1242,37 +1262,37 @@ var SimpleObject = /*#__PURE__*/function (_MapableObject, _setValue, _setTemp, _
|
|
|
1242
1262
|
}
|
|
1243
1263
|
}, {
|
|
1244
1264
|
key: "setTemp",
|
|
1245
|
-
value: function setTemp(
|
|
1246
|
-
return (_setTemp2 = _setTemp2 || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1265
|
+
value: function setTemp(_x25, _x26, _x27) {
|
|
1266
|
+
return (_setTemp2 = _setTemp2 || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(obj, key, value) {
|
|
1247
1267
|
var sendChanges,
|
|
1248
|
-
|
|
1249
|
-
return _regeneratorRuntime().wrap(function
|
|
1250
|
-
while (1) switch (
|
|
1268
|
+
_args16 = arguments;
|
|
1269
|
+
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
|
1270
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
1251
1271
|
case 0:
|
|
1252
|
-
sendChanges =
|
|
1272
|
+
sendChanges = _args16.length > 3 && _args16[3] !== undefined ? _args16[3] : false;
|
|
1253
1273
|
if (!(_typeof(obj) !== "object" || !obj || Array.isArray(obj))) {
|
|
1254
|
-
|
|
1274
|
+
_context16.next = 3;
|
|
1255
1275
|
break;
|
|
1256
1276
|
}
|
|
1257
|
-
return
|
|
1277
|
+
return _context16.abrupt("return");
|
|
1258
1278
|
case 3:
|
|
1259
1279
|
if (!(obj instanceof SimpleObject)) {
|
|
1260
|
-
|
|
1280
|
+
_context16.next = 7;
|
|
1261
1281
|
break;
|
|
1262
1282
|
}
|
|
1263
|
-
|
|
1283
|
+
_context16.next = 6;
|
|
1264
1284
|
return obj.setTemp(key, value, sendChanges);
|
|
1265
1285
|
case 6:
|
|
1266
|
-
return
|
|
1286
|
+
return _context16.abrupt("return", _context16.sent);
|
|
1267
1287
|
case 7:
|
|
1268
1288
|
//
|
|
1269
1289
|
if (obj.__temp == null) obj.__temp = {};
|
|
1270
1290
|
(0, _object.object_set)(obj.__temp, key, value);
|
|
1271
1291
|
case 9:
|
|
1272
1292
|
case "end":
|
|
1273
|
-
return
|
|
1293
|
+
return _context16.stop();
|
|
1274
1294
|
}
|
|
1275
|
-
},
|
|
1295
|
+
}, _callee16);
|
|
1276
1296
|
}))).apply(this, arguments);
|
|
1277
1297
|
}
|
|
1278
1298
|
}, {
|
|
@@ -1283,36 +1303,36 @@ var SimpleObject = /*#__PURE__*/function (_MapableObject, _setValue, _setTemp, _
|
|
|
1283
1303
|
}
|
|
1284
1304
|
}, {
|
|
1285
1305
|
key: "delete_cache",
|
|
1286
|
-
value: function delete_cache(
|
|
1287
|
-
return (_delete_cache = _delete_cache || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1306
|
+
value: function delete_cache(_x28) {
|
|
1307
|
+
return (_delete_cache = _delete_cache || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(context) {
|
|
1288
1308
|
var cacheKey;
|
|
1289
|
-
return _regeneratorRuntime().wrap(function
|
|
1290
|
-
while (1) switch (
|
|
1309
|
+
return _regeneratorRuntime().wrap(function _callee17$(_context17) {
|
|
1310
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
1291
1311
|
case 0:
|
|
1292
1312
|
if (this.__cache_name) {
|
|
1293
|
-
|
|
1313
|
+
_context17.next = 2;
|
|
1294
1314
|
break;
|
|
1295
1315
|
}
|
|
1296
|
-
return
|
|
1316
|
+
return _context17.abrupt("return");
|
|
1297
1317
|
case 2:
|
|
1298
1318
|
if (context) {
|
|
1299
|
-
|
|
1319
|
+
_context17.next = 7;
|
|
1300
1320
|
break;
|
|
1301
1321
|
}
|
|
1302
|
-
|
|
1322
|
+
_context17.next = 5;
|
|
1303
1323
|
return _global.gcache.delete_session_cache(this.__cache_name);
|
|
1304
1324
|
case 5:
|
|
1305
|
-
|
|
1325
|
+
_context17.next = 10;
|
|
1306
1326
|
break;
|
|
1307
1327
|
case 7:
|
|
1308
1328
|
cacheKey = "".concat(this.__cache_name, "-").concat(context);
|
|
1309
|
-
|
|
1329
|
+
_context17.next = 10;
|
|
1310
1330
|
return _global.gcache.delete_session_cache(cacheKey);
|
|
1311
1331
|
case 10:
|
|
1312
1332
|
case "end":
|
|
1313
|
-
return
|
|
1333
|
+
return _context17.stop();
|
|
1314
1334
|
}
|
|
1315
|
-
},
|
|
1335
|
+
}, _callee17, this);
|
|
1316
1336
|
}))).apply(this, arguments);
|
|
1317
1337
|
}
|
|
1318
1338
|
}, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@azrico/webobject",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.122",
|
|
4
4
|
"description": "Stateful object",
|
|
5
5
|
"author": "Azrideus",
|
|
6
6
|
"license": "MIT",
|
|
@@ -73,10 +73,10 @@
|
|
|
73
73
|
"dependencies": {
|
|
74
74
|
"@azrico/convert": "^1.0.5",
|
|
75
75
|
"@azrico/event": "^1.2.17",
|
|
76
|
-
"@azrico/global": "^1.3.
|
|
76
|
+
"@azrico/global": "^1.3.69",
|
|
77
77
|
"@azrico/math": "^1.0.5",
|
|
78
|
-
"@azrico/object": "^1.4.
|
|
79
|
-
"@azrico/string": "^1.2.
|
|
78
|
+
"@azrico/object": "^1.4.99",
|
|
79
|
+
"@azrico/string": "^1.2.91",
|
|
80
80
|
"@azrico/types": "^1.0.4",
|
|
81
81
|
"@azrico/uid": "^1.0.5"
|
|
82
82
|
},
|