@azrico/webobject 1.4.118 → 1.4.120

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.
@@ -32,6 +32,9 @@ export declare class SimpleObject extends MapableObject {
32
32
  _deletedBy?: string;
33
33
  protected __errors?: any[];
34
34
  protected __showErrors?: boolean;
35
+ protected __refresh_functions?: {
36
+ [key: string]: any;
37
+ };
35
38
  protected __saveResultObject?: any;
36
39
  protected __saveResultIsSuccess: boolean;
37
40
  protected __saveResultType?: saveResultType;
@@ -52,8 +55,10 @@ export declare class SimpleObject extends MapableObject {
52
55
  setValue(key: WriteablePropOf<this>, value: any, sendChanges?: sendChangesType): Promise<boolean>;
53
56
  set: (key: WriteablePropOf<this>, value: any, sendChanges?: sendChangesType) => Promise<boolean>;
54
57
  setTemp(key: string, value: any, sendChanges?: sendChangesType): Promise<boolean>;
55
- setRefreshFunction(v: any): Promise<void>;
56
- runRefreshFunction(...params: any): Promise<any>;
58
+ clearRefreshFunction(): Promise<void>;
59
+ setRefreshFunction(new_fnc: any): Promise<any>;
60
+ addRefreshFunction(new_fnc: any): any;
61
+ runRefreshFunction(...params: any): Promise<void>;
57
62
  setAll<K extends WriteablePropOf<this>>(setObj: {
58
63
  [key in K]: any;
59
64
  }): Promise<boolean>;
@@ -10,7 +10,6 @@ var _global = require("@azrico/global");
10
10
  var _MapableObject2 = require("./MapableObject");
11
11
  var _ObjectManager = _interopRequireDefault(require("./ObjectManager"));
12
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
13
- 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); }
14
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; }
15
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; }
16
15
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
@@ -19,6 +18,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
19
18
  function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
20
19
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
21
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
+ 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
22
  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
23
  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); } }
24
24
  function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
@@ -46,7 +46,7 @@ var _setProperty = /*#__PURE__*/new WeakSet();
46
46
  var _setDefaultProperty = /*#__PURE__*/new WeakSet();
47
47
  var _getProperty = /*#__PURE__*/new WeakSet();
48
48
  var _setSaveResultObject = /*#__PURE__*/new WeakSet();
49
- var SimpleObject = /*#__PURE__*/function (_MapableObject, _setValue, _setTemp, _setRefreshFunction, _runRefreshFunction, _setAll, _setSubValue, _pushValue, _notifyChanged, _reset, _resetAll, _event_run, _event_add, _setTemp2, _delete_cache) {
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) {
50
50
  _inherits(SimpleObject, _MapableObject);
51
51
  var _super = _createSuper(SimpleObject);
52
52
  function SimpleObject() {
@@ -83,6 +83,8 @@ var SimpleObject = /*#__PURE__*/function (_MapableObject, _setValue, _setTemp, _
83
83
  //errors
84
84
  _defineProperty(_assertThisInitialized(_this), "__errors", void 0);
85
85
  _defineProperty(_assertThisInitialized(_this), "__showErrors", void 0);
86
+ //refresh func
87
+ _defineProperty(_assertThisInitialized(_this), "__refresh_functions", void 0);
86
88
  //save results
87
89
  _defineProperty(_assertThisInitialized(_this), "__saveResultObject", void 0);
88
90
  _defineProperty(_assertThisInitialized(_this), "__saveResultIsSuccess", true);
@@ -215,80 +217,142 @@ var SimpleObject = /*#__PURE__*/function (_MapableObject, _setValue, _setTemp, _
215
217
  }))).apply(this, arguments);
216
218
  } /* ---------------------------- refresh functions --------------------------- */
217
219
  }, {
218
- key: "setRefreshFunction",
219
- value: function setRefreshFunction(_x5) {
220
- return (_setRefreshFunction = _setRefreshFunction || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(v) {
220
+ key: "clearRefreshFunction",
221
+ value: function clearRefreshFunction() {
222
+ return (_clearRefreshFunction = _clearRefreshFunction || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
221
223
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
222
224
  while (1) switch (_context3.prev = _context3.next) {
223
225
  case 0:
224
- _context3.next = 2;
225
- return this.setTemp("refresh_function", v);
226
- case 2:
226
+ this.__refresh_functions = undefined;
227
+ case 1:
227
228
  case "end":
228
229
  return _context3.stop();
229
230
  }
230
231
  }, _callee3, this);
231
232
  }))).apply(this, arguments);
232
233
  }
234
+ }, {
235
+ key: "setRefreshFunction",
236
+ value: function setRefreshFunction(_x5) {
237
+ return (_setRefreshFunction = _setRefreshFunction || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(new_fnc) {
238
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
239
+ while (1) switch (_context4.prev = _context4.next) {
240
+ case 0:
241
+ _context4.next = 2;
242
+ return this.addRefreshFunction(new_fnc);
243
+ case 2:
244
+ return _context4.abrupt("return", _context4.sent);
245
+ case 3:
246
+ case "end":
247
+ return _context4.stop();
248
+ }
249
+ }, _callee4, this);
250
+ }))).apply(this, arguments);
251
+ }
252
+ }, {
253
+ key: "addRefreshFunction",
254
+ value: function addRefreshFunction(_x6, _x7) {
255
+ return (_addRefreshFunction = _addRefreshFunction || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(key, new_fnc) {
256
+ var oldFunctions;
257
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
258
+ while (1) switch (_context5.prev = _context5.next) {
259
+ case 0:
260
+ if (typeof key === "function") {
261
+ new_fnc = key;
262
+ key = "main";
263
+ }
264
+ key = key || "main";
265
+ oldFunctions = this.__refresh_functions;
266
+ if (oldFunctions == null || _typeof(oldFunctions) !== "object") oldFunctions = {};
267
+ oldFunctions[key] = new_fnc;
268
+ this.__refresh_functions = oldFunctions;
269
+ case 6:
270
+ case "end":
271
+ return _context5.stop();
272
+ }
273
+ }, _callee5, this);
274
+ }))).apply(this, arguments);
275
+ }
233
276
  }, {
234
277
  key: "runRefreshFunction",
235
278
  value: function runRefreshFunction() {
236
- return (_runRefreshFunction = _runRefreshFunction || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
237
- var _len,
279
+ return (_runRefreshFunction = _runRefreshFunction || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
280
+ var oldFunctions,
281
+ fncArray,
282
+ _len,
238
283
  params,
239
284
  _key,
240
- _args4 = arguments;
241
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
242
- while (1) switch (_context4.prev = _context4.next) {
285
+ index,
286
+ fnc,
287
+ _args6 = arguments;
288
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
289
+ while (1) switch (_context6.prev = _context6.next) {
243
290
  case 0:
244
- for (_len = _args4.length, params = new Array(_len), _key = 0; _key < _len; _key++) {
245
- params[_key] = _args4[_key];
291
+ oldFunctions = this.__refresh_functions;
292
+ if (!(oldFunctions == null || _typeof(oldFunctions) !== "object")) {
293
+ _context6.next = 3;
294
+ break;
246
295
  }
247
- _context4.next = 3;
248
- return _object.fn_eval.apply(void 0, [this.getTemp("refresh_function")].concat(params));
296
+ return _context6.abrupt("return");
249
297
  case 3:
250
- return _context4.abrupt("return", _context4.sent);
251
- case 4:
298
+ fncArray = Object.values(oldFunctions);
299
+ for (_len = _args6.length, params = new Array(_len), _key = 0; _key < _len; _key++) {
300
+ params[_key] = _args6[_key];
301
+ }
302
+ index = 0;
303
+ case 6:
304
+ if (!(index < fncArray.length)) {
305
+ _context6.next = 13;
306
+ break;
307
+ }
308
+ fnc = fncArray[index];
309
+ _context6.next = 10;
310
+ return _object.fn_eval.apply(void 0, [fnc].concat(params));
311
+ case 10:
312
+ index++;
313
+ _context6.next = 6;
314
+ break;
315
+ case 13:
252
316
  case "end":
253
- return _context4.stop();
317
+ return _context6.stop();
254
318
  }
255
- }, _callee4, this);
319
+ }, _callee6, this);
256
320
  }))).apply(this, arguments);
257
321
  } /* -------------------------------------------------------------------------- */
258
322
  }, {
259
323
  key: "setAll",
260
- value: function setAll(_x6) {
261
- return (_setAll = _setAll || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(setObj) {
324
+ value: function setAll(_x8) {
325
+ return (_setAll = _setAll || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(setObj) {
262
326
  var finalRes, key;
263
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
264
- while (1) switch (_context5.prev = _context5.next) {
327
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
328
+ while (1) switch (_context7.prev = _context7.next) {
265
329
  case 0:
266
330
  finalRes = true;
267
- _context5.t0 = _regeneratorRuntime().keys(setObj);
331
+ _context7.t0 = _regeneratorRuntime().keys(setObj);
268
332
  case 2:
269
- if ((_context5.t1 = _context5.t0()).done) {
270
- _context5.next = 10;
333
+ if ((_context7.t1 = _context7.t0()).done) {
334
+ _context7.next = 10;
271
335
  break;
272
336
  }
273
- key = _context5.t1.value;
274
- _context5.next = 6;
337
+ key = _context7.t1.value;
338
+ _context7.next = 6;
275
339
  return this.setValue(key, setObj[key]);
276
340
  case 6:
277
- if (_context5.sent) {
278
- _context5.next = 8;
341
+ if (_context7.sent) {
342
+ _context7.next = 8;
279
343
  break;
280
344
  }
281
345
  finalRes = false;
282
346
  case 8:
283
- _context5.next = 2;
347
+ _context7.next = 2;
284
348
  break;
285
349
  case 10:
286
- return _context5.abrupt("return", finalRes);
350
+ return _context7.abrupt("return", finalRes);
287
351
  case 11:
288
352
  case "end":
289
- return _context5.stop();
353
+ return _context7.stop();
290
354
  }
291
- }, _callee5, this);
355
+ }, _callee7, this);
292
356
  }))).apply(this, arguments);
293
357
  }
294
358
  /**
@@ -312,30 +376,30 @@ var SimpleObject = /*#__PURE__*/function (_MapableObject, _setValue, _setTemp, _
312
376
  * @param subvalue
313
377
  * @return true if changed , false otherwise
314
378
  */
315
- function setSubValue(_x7, _x8, _x9) {
316
- return (_setSubValue = _setSubValue || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(key, objKey, subvalue) {
379
+ function setSubValue(_x9, _x10, _x11) {
380
+ return (_setSubValue = _setSubValue || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(key, objKey, subvalue) {
317
381
  var sendChanges,
318
382
  isValueChanged,
319
383
  subval,
320
- _args6 = arguments;
321
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
322
- while (1) switch (_context6.prev = _context6.next) {
384
+ _args8 = arguments;
385
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
386
+ while (1) switch (_context8.prev = _context8.next) {
323
387
  case 0:
324
- sendChanges = _args6.length > 3 && _args6[3] !== undefined ? _args6[3] : "auto";
388
+ sendChanges = _args8.length > 3 && _args8[3] !== undefined ? _args8[3] : "auto";
325
389
  if (this.canModify) {
326
- _context6.next = 7;
390
+ _context8.next = 7;
327
391
  break;
328
392
  }
329
393
  if (!(this.__throw_errors !== false)) {
330
- _context6.next = 6;
394
+ _context8.next = 6;
331
395
  break;
332
396
  }
333
397
  throw Error("Cant use setValue when on readonly mode");
334
398
  case 6:
335
- return _context6.abrupt("return", false);
399
+ return _context8.abrupt("return", false);
336
400
  case 7:
337
401
  isValueChanged = false;
338
- _context6.prev = 8;
402
+ _context8.prev = 8;
339
403
  //if accessing subval of an object, make sure the object is not null
340
404
  subval = _classPrivateMethodGet(this, _getSubProperty, _getSubProperty2).call(this, key, objKey);
341
405
  if (!(0, _object.object_equals)(subval, subvalue, {
@@ -346,22 +410,22 @@ var SimpleObject = /*#__PURE__*/function (_MapableObject, _setValue, _setTemp, _
346
410
  isValueChanged = true;
347
411
  } else isValueChanged = false;
348
412
  case 11:
349
- _context6.prev = 11;
413
+ _context8.prev = 11;
350
414
  if (!(sendChanges === true || sendChanges === "auto" && isValueChanged)) {
351
- _context6.next = 15;
415
+ _context8.next = 15;
352
416
  break;
353
417
  }
354
- _context6.next = 15;
418
+ _context8.next = 15;
355
419
  return this.notifyChanged("", key, objKey, subvalue);
356
420
  case 15:
357
- return _context6.finish(11);
421
+ return _context8.finish(11);
358
422
  case 16:
359
- return _context6.abrupt("return", isValueChanged);
423
+ return _context8.abrupt("return", isValueChanged);
360
424
  case 17:
361
425
  case "end":
362
- return _context6.stop();
426
+ return _context8.stop();
363
427
  }
364
- }, _callee6, this, [[8,, 11, 16]]);
428
+ }, _callee8, this, [[8,, 11, 16]]);
365
429
  }))).apply(this, arguments);
366
430
  }
367
431
  }, {
@@ -374,72 +438,72 @@ var SimpleObject = /*#__PURE__*/function (_MapableObject, _setValue, _setTemp, _
374
438
  * @param sendChanges
375
439
  * @returns
376
440
  */
377
- function pushValue(_x10, _x11) {
378
- return (_pushValue = _pushValue || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(key, value) {
441
+ function pushValue(_x12, _x13) {
442
+ return (_pushValue = _pushValue || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(key, value) {
379
443
  var sendChanges,
380
444
  tempArray,
381
- _args7 = arguments;
382
- return _regeneratorRuntime().wrap(function _callee7$(_context7) {
383
- while (1) switch (_context7.prev = _context7.next) {
445
+ _args9 = arguments;
446
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
447
+ while (1) switch (_context9.prev = _context9.next) {
384
448
  case 0:
385
- sendChanges = _args7.length > 2 && _args7[2] !== undefined ? _args7[2] : "auto";
449
+ sendChanges = _args9.length > 2 && _args9[2] !== undefined ? _args9[2] : "auto";
386
450
  if (!(value == null)) {
387
- _context7.next = 3;
451
+ _context9.next = 3;
388
452
  break;
389
453
  }
390
- return _context7.abrupt("return", false);
454
+ return _context9.abrupt("return", false);
391
455
  case 3:
392
456
  if (this.canModify) {
393
- _context7.next = 9;
457
+ _context9.next = 9;
394
458
  break;
395
459
  }
396
460
  if (!(this.__throw_errors !== false)) {
397
- _context7.next = 8;
461
+ _context9.next = 8;
398
462
  break;
399
463
  }
400
464
  throw Error("Cant use pushValue when on readonly mode");
401
465
  case 8:
402
- return _context7.abrupt("return", false);
466
+ return _context9.abrupt("return", false);
403
467
  case 9:
404
468
  if (_classPrivateMethodGet(this, _getProperty, _getProperty2).call(this, key) == null) {
405
469
  _classPrivateMethodGet(this, _setProperty, _setProperty2).call(this, key, []);
406
470
  }
407
471
  tempArray = _classPrivateMethodGet(this, _getProperty, _getProperty2).call(this, key);
408
472
  if (Array.isArray(tempArray)) {
409
- _context7.next = 17;
473
+ _context9.next = 17;
410
474
  break;
411
475
  }
412
476
  if (!(this.__throw_errors !== false)) {
413
- _context7.next = 16;
477
+ _context9.next = 16;
414
478
  break;
415
479
  }
416
480
  throw Error("Cant use pushValue on non Array keys");
417
481
  case 16:
418
- return _context7.abrupt("return", false);
482
+ return _context9.abrupt("return", false);
419
483
  case 17:
420
484
  _classPrivateMethodGet(this, _setProperty, _setProperty2).call(this, key, [].concat(_toConsumableArray(tempArray), [value]));
421
485
  if (!(sendChanges === true || sendChanges === "auto")) {
422
- _context7.next = 21;
486
+ _context9.next = 21;
423
487
  break;
424
488
  }
425
- _context7.next = 21;
489
+ _context9.next = 21;
426
490
  return this.notifyChanged("", key, value);
427
491
  case 21:
428
- return _context7.abrupt("return", tempArray);
492
+ return _context9.abrupt("return", tempArray);
429
493
  case 22:
430
494
  case "end":
431
- return _context7.stop();
495
+ return _context9.stop();
432
496
  }
433
- }, _callee7, this);
497
+ }, _callee9, this);
434
498
  }))).apply(this, arguments);
435
499
  }
436
500
  }, {
437
501
  key: "notifyChanged",
438
- value: function notifyChanged(_x12, _x13, _x14, _x15) {
439
- return (_notifyChanged = _notifyChanged || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(type, key, value, subvalue) {
502
+ value: function notifyChanged(_x14, _x15, _x16, _x17) {
503
+ return (_notifyChanged = _notifyChanged || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(type, key, value, subvalue) {
440
504
  var lc, manager_class;
441
- return _regeneratorRuntime().wrap(function _callee8$(_context8) {
442
- while (1) switch (_context8.prev = _context8.next) {
505
+ return _regeneratorRuntime().wrap(function _callee10$(_context10) {
506
+ while (1) switch (_context10.prev = _context10.next) {
443
507
  case 0:
444
508
  if (value === undefined && type == "") value = this.getValue(key);
445
509
  this.__changed = true;
@@ -454,16 +518,16 @@ var SimpleObject = /*#__PURE__*/function (_MapableObject, _setValue, _setTemp, _
454
518
  /* --------------------------- notify the manager --------------------------- */
455
519
  manager_class = this.manager;
456
520
  if (!(manager_class instanceof _ObjectManager["default"])) {
457
- _context8.next = 10;
521
+ _context10.next = 10;
458
522
  break;
459
523
  }
460
- _context8.next = 10;
524
+ _context10.next = 10;
461
525
  return manager_class.notifyChanged(type, key, value, subvalue);
462
526
  case 10:
463
527
  case "end":
464
- return _context8.stop();
528
+ return _context10.stop();
465
529
  }
466
- }, _callee8, this);
530
+ }, _callee10, this);
467
531
  }))).apply(this, arguments);
468
532
  }
469
533
  /**
@@ -527,23 +591,23 @@ var SimpleObject = /*#__PURE__*/function (_MapableObject, _setValue, _setTemp, _
527
591
  */
528
592
  }, {
529
593
  key: "reset",
530
- value: function reset(_x16) {
531
- return (_reset = _reset || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(key) {
594
+ value: function reset(_x18) {
595
+ return (_reset = _reset || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(key) {
532
596
  var notifyChanged,
533
- _args9 = arguments;
534
- return _regeneratorRuntime().wrap(function _callee9$(_context9) {
535
- while (1) switch (_context9.prev = _context9.next) {
597
+ _args11 = arguments;
598
+ return _regeneratorRuntime().wrap(function _callee11$(_context11) {
599
+ while (1) switch (_context11.prev = _context11.next) {
536
600
  case 0:
537
- notifyChanged = _args9.length > 1 && _args9[1] !== undefined ? _args9[1] : "auto";
538
- _context9.next = 3;
601
+ notifyChanged = _args11.length > 1 && _args11[1] !== undefined ? _args11[1] : "auto";
602
+ _context11.next = 3;
539
603
  return this.setValue(key, this[key], notifyChanged);
540
604
  case 3:
541
- return _context9.abrupt("return", _context9.sent);
605
+ return _context11.abrupt("return", _context11.sent);
542
606
  case 4:
543
607
  case "end":
544
- return _context9.stop();
608
+ return _context11.stop();
545
609
  }
546
- }, _callee9, this);
610
+ }, _callee11, this);
547
611
  }))).apply(this, arguments);
548
612
  }
549
613
  /**
@@ -554,43 +618,43 @@ var SimpleObject = /*#__PURE__*/function (_MapableObject, _setValue, _setTemp, _
554
618
  }, {
555
619
  key: "resetAll",
556
620
  value: function resetAll() {
557
- return (_resetAll = _resetAll || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
621
+ return (_resetAll = _resetAll || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
558
622
  var notifyChanged,
559
623
  fr,
560
624
  key,
561
- _args10 = arguments;
562
- return _regeneratorRuntime().wrap(function _callee10$(_context10) {
563
- while (1) switch (_context10.prev = _context10.next) {
625
+ _args12 = arguments;
626
+ return _regeneratorRuntime().wrap(function _callee12$(_context12) {
627
+ while (1) switch (_context12.prev = _context12.next) {
564
628
  case 0:
565
- notifyChanged = _args10.length > 0 && _args10[0] !== undefined ? _args10[0] : "auto";
629
+ notifyChanged = _args12.length > 0 && _args12[0] !== undefined ? _args12[0] : "auto";
566
630
  fr = true;
567
- _context10.t0 = _regeneratorRuntime().keys(this.__delta);
631
+ _context12.t0 = _regeneratorRuntime().keys(this.__delta);
568
632
  case 3:
569
- if ((_context10.t1 = _context10.t0()).done) {
570
- _context10.next = 13;
633
+ if ((_context12.t1 = _context12.t0()).done) {
634
+ _context12.next = 13;
571
635
  break;
572
636
  }
573
- key = _context10.t1.value;
574
- _context10.t2 = fr;
575
- if (!_context10.t2) {
576
- _context10.next = 10;
637
+ key = _context12.t1.value;
638
+ _context12.t2 = fr;
639
+ if (!_context12.t2) {
640
+ _context12.next = 10;
577
641
  break;
578
642
  }
579
- _context10.next = 9;
643
+ _context12.next = 9;
580
644
  return this.reset(key, notifyChanged);
581
645
  case 9:
582
- _context10.t2 = _context10.sent;
646
+ _context12.t2 = _context12.sent;
583
647
  case 10:
584
- fr = _context10.t2;
585
- _context10.next = 3;
648
+ fr = _context12.t2;
649
+ _context12.next = 3;
586
650
  break;
587
651
  case 13:
588
- return _context10.abrupt("return", fr);
652
+ return _context12.abrupt("return", fr);
589
653
  case 14:
590
654
  case "end":
591
- return _context10.stop();
655
+ return _context12.stop();
592
656
  }
593
- }, _callee10, this);
657
+ }, _callee12, this);
594
658
  }))).apply(this, arguments);
595
659
  }
596
660
  /**
@@ -762,35 +826,35 @@ var SimpleObject = /*#__PURE__*/function (_MapableObject, _setValue, _setTemp, _
762
826
  /* -------------------------------------------------------------------------- */
763
827
  /* Events */
764
828
  /* -------------------------------------------------------------------------- */
765
- function event_run(_x17) {
766
- return (_event_run = _event_run || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(eventName) {
829
+ function event_run(_x19) {
830
+ return (_event_run = _event_run || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(eventName) {
767
831
  var _this$manager;
768
832
  var _len2,
769
833
  params,
770
834
  _key2,
771
- _args11 = arguments;
772
- return _regeneratorRuntime().wrap(function _callee11$(_context11) {
773
- while (1) switch (_context11.prev = _context11.next) {
835
+ _args13 = arguments;
836
+ return _regeneratorRuntime().wrap(function _callee13$(_context13) {
837
+ while (1) switch (_context13.prev = _context13.next) {
774
838
  case 0:
775
839
  if (this.manager) {
776
- _context11.next = 3;
840
+ _context13.next = 3;
777
841
  break;
778
842
  }
779
843
  if (this.__showErrors === true) console.error("you cant use events if your object has no manager");
780
- return _context11.abrupt("return");
844
+ return _context13.abrupt("return");
781
845
  case 3:
782
- for (_len2 = _args11.length, params = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
783
- params[_key2 - 1] = _args11[_key2];
846
+ for (_len2 = _args13.length, params = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
847
+ params[_key2 - 1] = _args13[_key2];
784
848
  }
785
- _context11.next = 6;
849
+ _context13.next = 6;
786
850
  return (_this$manager = this.manager).event_run.apply(_this$manager, [eventName].concat(params));
787
851
  case 6:
788
- return _context11.abrupt("return", _context11.sent);
852
+ return _context13.abrupt("return", _context13.sent);
789
853
  case 7:
790
854
  case "end":
791
- return _context11.stop();
855
+ return _context13.stop();
792
856
  }
793
- }, _callee11, this);
857
+ }, _callee13, this);
794
858
  }))).apply(this, arguments);
795
859
  }
796
860
  }, {
@@ -815,30 +879,30 @@ var SimpleObject = /*#__PURE__*/function (_MapableObject, _setValue, _setTemp, _
815
879
  }
816
880
  }, {
817
881
  key: "event_add",
818
- value: function event_add(_x18, _x19, _x20) {
819
- return (_event_add = _event_add || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(name, uname, runEvent) {
882
+ value: function event_add(_x20, _x21, _x22) {
883
+ return (_event_add = _event_add || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(name, uname, runEvent) {
820
884
  var onlyOn,
821
885
  runOnce,
822
- _args12 = arguments;
823
- return _regeneratorRuntime().wrap(function _callee12$(_context12) {
824
- while (1) switch (_context12.prev = _context12.next) {
886
+ _args14 = arguments;
887
+ return _regeneratorRuntime().wrap(function _callee14$(_context14) {
888
+ while (1) switch (_context14.prev = _context14.next) {
825
889
  case 0:
826
- onlyOn = _args12.length > 3 && _args12[3] !== undefined ? _args12[3] : null;
827
- runOnce = _args12.length > 4 && _args12[4] !== undefined ? _args12[4] : false;
890
+ onlyOn = _args14.length > 3 && _args14[3] !== undefined ? _args14[3] : null;
891
+ runOnce = _args14.length > 4 && _args14[4] !== undefined ? _args14[4] : false;
828
892
  if (this.manager) {
829
- _context12.next = 5;
893
+ _context14.next = 5;
830
894
  break;
831
895
  }
832
896
  if (this.__showErrors === true) console.error("you cant use events if your object has no manager");
833
- return _context12.abrupt("return");
897
+ return _context14.abrupt("return");
834
898
  case 5:
835
- _context12.next = 7;
899
+ _context14.next = 7;
836
900
  return this.manager.event_add(name, uname, runEvent, onlyOn, runOnce);
837
901
  case 7:
838
902
  case "end":
839
- return _context12.stop();
903
+ return _context14.stop();
840
904
  }
841
- }, _callee12, this);
905
+ }, _callee14, this);
842
906
  }))).apply(this, arguments);
843
907
  }
844
908
  /* -------------------------------------------------------------------------- */
@@ -1178,37 +1242,37 @@ var SimpleObject = /*#__PURE__*/function (_MapableObject, _setValue, _setTemp, _
1178
1242
  }
1179
1243
  }, {
1180
1244
  key: "setTemp",
1181
- value: function setTemp(_x21, _x22, _x23) {
1182
- return (_setTemp2 = _setTemp2 || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(obj, key, value) {
1245
+ value: function setTemp(_x23, _x24, _x25) {
1246
+ return (_setTemp2 = _setTemp2 || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(obj, key, value) {
1183
1247
  var sendChanges,
1184
- _args13 = arguments;
1185
- return _regeneratorRuntime().wrap(function _callee13$(_context13) {
1186
- while (1) switch (_context13.prev = _context13.next) {
1248
+ _args15 = arguments;
1249
+ return _regeneratorRuntime().wrap(function _callee15$(_context15) {
1250
+ while (1) switch (_context15.prev = _context15.next) {
1187
1251
  case 0:
1188
- sendChanges = _args13.length > 3 && _args13[3] !== undefined ? _args13[3] : false;
1252
+ sendChanges = _args15.length > 3 && _args15[3] !== undefined ? _args15[3] : false;
1189
1253
  if (!(_typeof(obj) !== "object" || !obj || Array.isArray(obj))) {
1190
- _context13.next = 3;
1254
+ _context15.next = 3;
1191
1255
  break;
1192
1256
  }
1193
- return _context13.abrupt("return");
1257
+ return _context15.abrupt("return");
1194
1258
  case 3:
1195
1259
  if (!(obj instanceof SimpleObject)) {
1196
- _context13.next = 7;
1260
+ _context15.next = 7;
1197
1261
  break;
1198
1262
  }
1199
- _context13.next = 6;
1263
+ _context15.next = 6;
1200
1264
  return obj.setTemp(key, value, sendChanges);
1201
1265
  case 6:
1202
- return _context13.abrupt("return", _context13.sent);
1266
+ return _context15.abrupt("return", _context15.sent);
1203
1267
  case 7:
1204
1268
  //
1205
1269
  if (obj.__temp == null) obj.__temp = {};
1206
1270
  (0, _object.object_set)(obj.__temp, key, value);
1207
1271
  case 9:
1208
1272
  case "end":
1209
- return _context13.stop();
1273
+ return _context15.stop();
1210
1274
  }
1211
- }, _callee13);
1275
+ }, _callee15);
1212
1276
  }))).apply(this, arguments);
1213
1277
  }
1214
1278
  }, {
@@ -1219,36 +1283,36 @@ var SimpleObject = /*#__PURE__*/function (_MapableObject, _setValue, _setTemp, _
1219
1283
  }
1220
1284
  }, {
1221
1285
  key: "delete_cache",
1222
- value: function delete_cache(_x24) {
1223
- return (_delete_cache = _delete_cache || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(context) {
1286
+ value: function delete_cache(_x26) {
1287
+ return (_delete_cache = _delete_cache || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(context) {
1224
1288
  var cacheKey;
1225
- return _regeneratorRuntime().wrap(function _callee14$(_context14) {
1226
- while (1) switch (_context14.prev = _context14.next) {
1289
+ return _regeneratorRuntime().wrap(function _callee16$(_context16) {
1290
+ while (1) switch (_context16.prev = _context16.next) {
1227
1291
  case 0:
1228
1292
  if (this.__cache_name) {
1229
- _context14.next = 2;
1293
+ _context16.next = 2;
1230
1294
  break;
1231
1295
  }
1232
- return _context14.abrupt("return");
1296
+ return _context16.abrupt("return");
1233
1297
  case 2:
1234
1298
  if (context) {
1235
- _context14.next = 7;
1299
+ _context16.next = 7;
1236
1300
  break;
1237
1301
  }
1238
- _context14.next = 5;
1302
+ _context16.next = 5;
1239
1303
  return _global.gcache.delete_session_cache(this.__cache_name);
1240
1304
  case 5:
1241
- _context14.next = 10;
1305
+ _context16.next = 10;
1242
1306
  break;
1243
1307
  case 7:
1244
1308
  cacheKey = "".concat(this.__cache_name, "-").concat(context);
1245
- _context14.next = 10;
1309
+ _context16.next = 10;
1246
1310
  return _global.gcache.delete_session_cache(cacheKey);
1247
1311
  case 10:
1248
1312
  case "end":
1249
- return _context14.stop();
1313
+ return _context16.stop();
1250
1314
  }
1251
- }, _callee14, this);
1315
+ }, _callee16, this);
1252
1316
  }))).apply(this, arguments);
1253
1317
  }
1254
1318
  }, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azrico/webobject",
3
- "version": "1.4.118",
3
+ "version": "1.4.120",
4
4
  "description": "Stateful object",
5
5
  "author": "Azrideus",
6
6
  "license": "MIT",