@azrico/webobject 1.4.118 → 1.4.119

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,9 @@ 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
+ addRefreshFunction(key: string, new_fnc: any): Promise<void>;
60
+ runRefreshFunction(...params: any): Promise<void>;
57
61
  setAll<K extends WriteablePropOf<this>>(setObj: {
58
62
  [key in K]: any;
59
63
  }): 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, _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,15 +217,14 @@ 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 = {};
227
+ case 1:
227
228
  case "end":
228
229
  return _context3.stop();
229
230
  }
@@ -231,64 +232,99 @@ var SimpleObject = /*#__PURE__*/function (_MapableObject, _setValue, _setTemp, _
231
232
  }))).apply(this, arguments);
232
233
  }
233
234
  }, {
234
- key: "runRefreshFunction",
235
- value: function runRefreshFunction() {
236
- return (_runRefreshFunction = _runRefreshFunction || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
237
- var _len,
238
- params,
239
- _key,
240
- _args4 = arguments;
235
+ key: "addRefreshFunction",
236
+ value: function addRefreshFunction(_x5, _x6) {
237
+ return (_addRefreshFunction = _addRefreshFunction || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(key, new_fnc) {
238
+ var oldFunctions;
241
239
  return _regeneratorRuntime().wrap(function _callee4$(_context4) {
242
240
  while (1) switch (_context4.prev = _context4.next) {
243
241
  case 0:
244
- for (_len = _args4.length, params = new Array(_len), _key = 0; _key < _len; _key++) {
245
- params[_key] = _args4[_key];
246
- }
247
- _context4.next = 3;
248
- return _object.fn_eval.apply(void 0, [this.getTemp("refresh_function")].concat(params));
249
- case 3:
250
- return _context4.abrupt("return", _context4.sent);
242
+ oldFunctions = this.__refresh_functions;
243
+ if (oldFunctions == null || _typeof(oldFunctions) !== "object") oldFunctions = {};
244
+ oldFunctions[key] = new_fnc;
245
+ this.__refresh_functions = oldFunctions;
251
246
  case 4:
252
247
  case "end":
253
248
  return _context4.stop();
254
249
  }
255
250
  }, _callee4, this);
256
251
  }))).apply(this, arguments);
252
+ }
253
+ }, {
254
+ key: "runRefreshFunction",
255
+ value: function runRefreshFunction() {
256
+ return (_runRefreshFunction = _runRefreshFunction || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
257
+ var oldFunctions,
258
+ fncArray,
259
+ _len,
260
+ params,
261
+ _key,
262
+ index,
263
+ fnc,
264
+ _args5 = arguments;
265
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
266
+ while (1) switch (_context5.prev = _context5.next) {
267
+ case 0:
268
+ oldFunctions = this.__refresh_functions;
269
+ if (oldFunctions == null || _typeof(oldFunctions) !== "object") oldFunctions = {};
270
+ fncArray = Object.values(oldFunctions);
271
+ for (_len = _args5.length, params = new Array(_len), _key = 0; _key < _len; _key++) {
272
+ params[_key] = _args5[_key];
273
+ }
274
+ index = 0;
275
+ case 5:
276
+ if (!(index < fncArray.length)) {
277
+ _context5.next = 12;
278
+ break;
279
+ }
280
+ fnc = fncArray[index];
281
+ _context5.next = 9;
282
+ return _object.fn_eval.apply(void 0, [fnc].concat(params));
283
+ case 9:
284
+ index++;
285
+ _context5.next = 5;
286
+ break;
287
+ case 12:
288
+ case "end":
289
+ return _context5.stop();
290
+ }
291
+ }, _callee5, this);
292
+ }))).apply(this, arguments);
257
293
  } /* -------------------------------------------------------------------------- */
258
294
  }, {
259
295
  key: "setAll",
260
- value: function setAll(_x6) {
261
- return (_setAll = _setAll || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(setObj) {
296
+ value: function setAll(_x7) {
297
+ return (_setAll = _setAll || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(setObj) {
262
298
  var finalRes, key;
263
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
264
- while (1) switch (_context5.prev = _context5.next) {
299
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
300
+ while (1) switch (_context6.prev = _context6.next) {
265
301
  case 0:
266
302
  finalRes = true;
267
- _context5.t0 = _regeneratorRuntime().keys(setObj);
303
+ _context6.t0 = _regeneratorRuntime().keys(setObj);
268
304
  case 2:
269
- if ((_context5.t1 = _context5.t0()).done) {
270
- _context5.next = 10;
305
+ if ((_context6.t1 = _context6.t0()).done) {
306
+ _context6.next = 10;
271
307
  break;
272
308
  }
273
- key = _context5.t1.value;
274
- _context5.next = 6;
309
+ key = _context6.t1.value;
310
+ _context6.next = 6;
275
311
  return this.setValue(key, setObj[key]);
276
312
  case 6:
277
- if (_context5.sent) {
278
- _context5.next = 8;
313
+ if (_context6.sent) {
314
+ _context6.next = 8;
279
315
  break;
280
316
  }
281
317
  finalRes = false;
282
318
  case 8:
283
- _context5.next = 2;
319
+ _context6.next = 2;
284
320
  break;
285
321
  case 10:
286
- return _context5.abrupt("return", finalRes);
322
+ return _context6.abrupt("return", finalRes);
287
323
  case 11:
288
324
  case "end":
289
- return _context5.stop();
325
+ return _context6.stop();
290
326
  }
291
- }, _callee5, this);
327
+ }, _callee6, this);
292
328
  }))).apply(this, arguments);
293
329
  }
294
330
  /**
@@ -312,30 +348,30 @@ var SimpleObject = /*#__PURE__*/function (_MapableObject, _setValue, _setTemp, _
312
348
  * @param subvalue
313
349
  * @return true if changed , false otherwise
314
350
  */
315
- function setSubValue(_x7, _x8, _x9) {
316
- return (_setSubValue = _setSubValue || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(key, objKey, subvalue) {
351
+ function setSubValue(_x8, _x9, _x10) {
352
+ return (_setSubValue = _setSubValue || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(key, objKey, subvalue) {
317
353
  var sendChanges,
318
354
  isValueChanged,
319
355
  subval,
320
- _args6 = arguments;
321
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
322
- while (1) switch (_context6.prev = _context6.next) {
356
+ _args7 = arguments;
357
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
358
+ while (1) switch (_context7.prev = _context7.next) {
323
359
  case 0:
324
- sendChanges = _args6.length > 3 && _args6[3] !== undefined ? _args6[3] : "auto";
360
+ sendChanges = _args7.length > 3 && _args7[3] !== undefined ? _args7[3] : "auto";
325
361
  if (this.canModify) {
326
- _context6.next = 7;
362
+ _context7.next = 7;
327
363
  break;
328
364
  }
329
365
  if (!(this.__throw_errors !== false)) {
330
- _context6.next = 6;
366
+ _context7.next = 6;
331
367
  break;
332
368
  }
333
369
  throw Error("Cant use setValue when on readonly mode");
334
370
  case 6:
335
- return _context6.abrupt("return", false);
371
+ return _context7.abrupt("return", false);
336
372
  case 7:
337
373
  isValueChanged = false;
338
- _context6.prev = 8;
374
+ _context7.prev = 8;
339
375
  //if accessing subval of an object, make sure the object is not null
340
376
  subval = _classPrivateMethodGet(this, _getSubProperty, _getSubProperty2).call(this, key, objKey);
341
377
  if (!(0, _object.object_equals)(subval, subvalue, {
@@ -346,22 +382,22 @@ var SimpleObject = /*#__PURE__*/function (_MapableObject, _setValue, _setTemp, _
346
382
  isValueChanged = true;
347
383
  } else isValueChanged = false;
348
384
  case 11:
349
- _context6.prev = 11;
385
+ _context7.prev = 11;
350
386
  if (!(sendChanges === true || sendChanges === "auto" && isValueChanged)) {
351
- _context6.next = 15;
387
+ _context7.next = 15;
352
388
  break;
353
389
  }
354
- _context6.next = 15;
390
+ _context7.next = 15;
355
391
  return this.notifyChanged("", key, objKey, subvalue);
356
392
  case 15:
357
- return _context6.finish(11);
393
+ return _context7.finish(11);
358
394
  case 16:
359
- return _context6.abrupt("return", isValueChanged);
395
+ return _context7.abrupt("return", isValueChanged);
360
396
  case 17:
361
397
  case "end":
362
- return _context6.stop();
398
+ return _context7.stop();
363
399
  }
364
- }, _callee6, this, [[8,, 11, 16]]);
400
+ }, _callee7, this, [[8,, 11, 16]]);
365
401
  }))).apply(this, arguments);
366
402
  }
367
403
  }, {
@@ -374,72 +410,72 @@ var SimpleObject = /*#__PURE__*/function (_MapableObject, _setValue, _setTemp, _
374
410
  * @param sendChanges
375
411
  * @returns
376
412
  */
377
- function pushValue(_x10, _x11) {
378
- return (_pushValue = _pushValue || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(key, value) {
413
+ function pushValue(_x11, _x12) {
414
+ return (_pushValue = _pushValue || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(key, value) {
379
415
  var sendChanges,
380
416
  tempArray,
381
- _args7 = arguments;
382
- return _regeneratorRuntime().wrap(function _callee7$(_context7) {
383
- while (1) switch (_context7.prev = _context7.next) {
417
+ _args8 = arguments;
418
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
419
+ while (1) switch (_context8.prev = _context8.next) {
384
420
  case 0:
385
- sendChanges = _args7.length > 2 && _args7[2] !== undefined ? _args7[2] : "auto";
421
+ sendChanges = _args8.length > 2 && _args8[2] !== undefined ? _args8[2] : "auto";
386
422
  if (!(value == null)) {
387
- _context7.next = 3;
423
+ _context8.next = 3;
388
424
  break;
389
425
  }
390
- return _context7.abrupt("return", false);
426
+ return _context8.abrupt("return", false);
391
427
  case 3:
392
428
  if (this.canModify) {
393
- _context7.next = 9;
429
+ _context8.next = 9;
394
430
  break;
395
431
  }
396
432
  if (!(this.__throw_errors !== false)) {
397
- _context7.next = 8;
433
+ _context8.next = 8;
398
434
  break;
399
435
  }
400
436
  throw Error("Cant use pushValue when on readonly mode");
401
437
  case 8:
402
- return _context7.abrupt("return", false);
438
+ return _context8.abrupt("return", false);
403
439
  case 9:
404
440
  if (_classPrivateMethodGet(this, _getProperty, _getProperty2).call(this, key) == null) {
405
441
  _classPrivateMethodGet(this, _setProperty, _setProperty2).call(this, key, []);
406
442
  }
407
443
  tempArray = _classPrivateMethodGet(this, _getProperty, _getProperty2).call(this, key);
408
444
  if (Array.isArray(tempArray)) {
409
- _context7.next = 17;
445
+ _context8.next = 17;
410
446
  break;
411
447
  }
412
448
  if (!(this.__throw_errors !== false)) {
413
- _context7.next = 16;
449
+ _context8.next = 16;
414
450
  break;
415
451
  }
416
452
  throw Error("Cant use pushValue on non Array keys");
417
453
  case 16:
418
- return _context7.abrupt("return", false);
454
+ return _context8.abrupt("return", false);
419
455
  case 17:
420
456
  _classPrivateMethodGet(this, _setProperty, _setProperty2).call(this, key, [].concat(_toConsumableArray(tempArray), [value]));
421
457
  if (!(sendChanges === true || sendChanges === "auto")) {
422
- _context7.next = 21;
458
+ _context8.next = 21;
423
459
  break;
424
460
  }
425
- _context7.next = 21;
461
+ _context8.next = 21;
426
462
  return this.notifyChanged("", key, value);
427
463
  case 21:
428
- return _context7.abrupt("return", tempArray);
464
+ return _context8.abrupt("return", tempArray);
429
465
  case 22:
430
466
  case "end":
431
- return _context7.stop();
467
+ return _context8.stop();
432
468
  }
433
- }, _callee7, this);
469
+ }, _callee8, this);
434
470
  }))).apply(this, arguments);
435
471
  }
436
472
  }, {
437
473
  key: "notifyChanged",
438
- value: function notifyChanged(_x12, _x13, _x14, _x15) {
439
- return (_notifyChanged = _notifyChanged || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(type, key, value, subvalue) {
474
+ value: function notifyChanged(_x13, _x14, _x15, _x16) {
475
+ return (_notifyChanged = _notifyChanged || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(type, key, value, subvalue) {
440
476
  var lc, manager_class;
441
- return _regeneratorRuntime().wrap(function _callee8$(_context8) {
442
- while (1) switch (_context8.prev = _context8.next) {
477
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
478
+ while (1) switch (_context9.prev = _context9.next) {
443
479
  case 0:
444
480
  if (value === undefined && type == "") value = this.getValue(key);
445
481
  this.__changed = true;
@@ -454,16 +490,16 @@ var SimpleObject = /*#__PURE__*/function (_MapableObject, _setValue, _setTemp, _
454
490
  /* --------------------------- notify the manager --------------------------- */
455
491
  manager_class = this.manager;
456
492
  if (!(manager_class instanceof _ObjectManager["default"])) {
457
- _context8.next = 10;
493
+ _context9.next = 10;
458
494
  break;
459
495
  }
460
- _context8.next = 10;
496
+ _context9.next = 10;
461
497
  return manager_class.notifyChanged(type, key, value, subvalue);
462
498
  case 10:
463
499
  case "end":
464
- return _context8.stop();
500
+ return _context9.stop();
465
501
  }
466
- }, _callee8, this);
502
+ }, _callee9, this);
467
503
  }))).apply(this, arguments);
468
504
  }
469
505
  /**
@@ -527,23 +563,23 @@ var SimpleObject = /*#__PURE__*/function (_MapableObject, _setValue, _setTemp, _
527
563
  */
528
564
  }, {
529
565
  key: "reset",
530
- value: function reset(_x16) {
531
- return (_reset = _reset || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(key) {
566
+ value: function reset(_x17) {
567
+ return (_reset = _reset || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(key) {
532
568
  var notifyChanged,
533
- _args9 = arguments;
534
- return _regeneratorRuntime().wrap(function _callee9$(_context9) {
535
- while (1) switch (_context9.prev = _context9.next) {
569
+ _args10 = arguments;
570
+ return _regeneratorRuntime().wrap(function _callee10$(_context10) {
571
+ while (1) switch (_context10.prev = _context10.next) {
536
572
  case 0:
537
- notifyChanged = _args9.length > 1 && _args9[1] !== undefined ? _args9[1] : "auto";
538
- _context9.next = 3;
573
+ notifyChanged = _args10.length > 1 && _args10[1] !== undefined ? _args10[1] : "auto";
574
+ _context10.next = 3;
539
575
  return this.setValue(key, this[key], notifyChanged);
540
576
  case 3:
541
- return _context9.abrupt("return", _context9.sent);
577
+ return _context10.abrupt("return", _context10.sent);
542
578
  case 4:
543
579
  case "end":
544
- return _context9.stop();
580
+ return _context10.stop();
545
581
  }
546
- }, _callee9, this);
582
+ }, _callee10, this);
547
583
  }))).apply(this, arguments);
548
584
  }
549
585
  /**
@@ -554,43 +590,43 @@ var SimpleObject = /*#__PURE__*/function (_MapableObject, _setValue, _setTemp, _
554
590
  }, {
555
591
  key: "resetAll",
556
592
  value: function resetAll() {
557
- return (_resetAll = _resetAll || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
593
+ return (_resetAll = _resetAll || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
558
594
  var notifyChanged,
559
595
  fr,
560
596
  key,
561
- _args10 = arguments;
562
- return _regeneratorRuntime().wrap(function _callee10$(_context10) {
563
- while (1) switch (_context10.prev = _context10.next) {
597
+ _args11 = arguments;
598
+ return _regeneratorRuntime().wrap(function _callee11$(_context11) {
599
+ while (1) switch (_context11.prev = _context11.next) {
564
600
  case 0:
565
- notifyChanged = _args10.length > 0 && _args10[0] !== undefined ? _args10[0] : "auto";
601
+ notifyChanged = _args11.length > 0 && _args11[0] !== undefined ? _args11[0] : "auto";
566
602
  fr = true;
567
- _context10.t0 = _regeneratorRuntime().keys(this.__delta);
603
+ _context11.t0 = _regeneratorRuntime().keys(this.__delta);
568
604
  case 3:
569
- if ((_context10.t1 = _context10.t0()).done) {
570
- _context10.next = 13;
605
+ if ((_context11.t1 = _context11.t0()).done) {
606
+ _context11.next = 13;
571
607
  break;
572
608
  }
573
- key = _context10.t1.value;
574
- _context10.t2 = fr;
575
- if (!_context10.t2) {
576
- _context10.next = 10;
609
+ key = _context11.t1.value;
610
+ _context11.t2 = fr;
611
+ if (!_context11.t2) {
612
+ _context11.next = 10;
577
613
  break;
578
614
  }
579
- _context10.next = 9;
615
+ _context11.next = 9;
580
616
  return this.reset(key, notifyChanged);
581
617
  case 9:
582
- _context10.t2 = _context10.sent;
618
+ _context11.t2 = _context11.sent;
583
619
  case 10:
584
- fr = _context10.t2;
585
- _context10.next = 3;
620
+ fr = _context11.t2;
621
+ _context11.next = 3;
586
622
  break;
587
623
  case 13:
588
- return _context10.abrupt("return", fr);
624
+ return _context11.abrupt("return", fr);
589
625
  case 14:
590
626
  case "end":
591
- return _context10.stop();
627
+ return _context11.stop();
592
628
  }
593
- }, _callee10, this);
629
+ }, _callee11, this);
594
630
  }))).apply(this, arguments);
595
631
  }
596
632
  /**
@@ -762,35 +798,35 @@ var SimpleObject = /*#__PURE__*/function (_MapableObject, _setValue, _setTemp, _
762
798
  /* -------------------------------------------------------------------------- */
763
799
  /* Events */
764
800
  /* -------------------------------------------------------------------------- */
765
- function event_run(_x17) {
766
- return (_event_run = _event_run || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(eventName) {
801
+ function event_run(_x18) {
802
+ return (_event_run = _event_run || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(eventName) {
767
803
  var _this$manager;
768
804
  var _len2,
769
805
  params,
770
806
  _key2,
771
- _args11 = arguments;
772
- return _regeneratorRuntime().wrap(function _callee11$(_context11) {
773
- while (1) switch (_context11.prev = _context11.next) {
807
+ _args12 = arguments;
808
+ return _regeneratorRuntime().wrap(function _callee12$(_context12) {
809
+ while (1) switch (_context12.prev = _context12.next) {
774
810
  case 0:
775
811
  if (this.manager) {
776
- _context11.next = 3;
812
+ _context12.next = 3;
777
813
  break;
778
814
  }
779
815
  if (this.__showErrors === true) console.error("you cant use events if your object has no manager");
780
- return _context11.abrupt("return");
816
+ return _context12.abrupt("return");
781
817
  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];
818
+ for (_len2 = _args12.length, params = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
819
+ params[_key2 - 1] = _args12[_key2];
784
820
  }
785
- _context11.next = 6;
821
+ _context12.next = 6;
786
822
  return (_this$manager = this.manager).event_run.apply(_this$manager, [eventName].concat(params));
787
823
  case 6:
788
- return _context11.abrupt("return", _context11.sent);
824
+ return _context12.abrupt("return", _context12.sent);
789
825
  case 7:
790
826
  case "end":
791
- return _context11.stop();
827
+ return _context12.stop();
792
828
  }
793
- }, _callee11, this);
829
+ }, _callee12, this);
794
830
  }))).apply(this, arguments);
795
831
  }
796
832
  }, {
@@ -815,30 +851,30 @@ var SimpleObject = /*#__PURE__*/function (_MapableObject, _setValue, _setTemp, _
815
851
  }
816
852
  }, {
817
853
  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) {
854
+ value: function event_add(_x19, _x20, _x21) {
855
+ return (_event_add = _event_add || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(name, uname, runEvent) {
820
856
  var onlyOn,
821
857
  runOnce,
822
- _args12 = arguments;
823
- return _regeneratorRuntime().wrap(function _callee12$(_context12) {
824
- while (1) switch (_context12.prev = _context12.next) {
858
+ _args13 = arguments;
859
+ return _regeneratorRuntime().wrap(function _callee13$(_context13) {
860
+ while (1) switch (_context13.prev = _context13.next) {
825
861
  case 0:
826
- onlyOn = _args12.length > 3 && _args12[3] !== undefined ? _args12[3] : null;
827
- runOnce = _args12.length > 4 && _args12[4] !== undefined ? _args12[4] : false;
862
+ onlyOn = _args13.length > 3 && _args13[3] !== undefined ? _args13[3] : null;
863
+ runOnce = _args13.length > 4 && _args13[4] !== undefined ? _args13[4] : false;
828
864
  if (this.manager) {
829
- _context12.next = 5;
865
+ _context13.next = 5;
830
866
  break;
831
867
  }
832
868
  if (this.__showErrors === true) console.error("you cant use events if your object has no manager");
833
- return _context12.abrupt("return");
869
+ return _context13.abrupt("return");
834
870
  case 5:
835
- _context12.next = 7;
871
+ _context13.next = 7;
836
872
  return this.manager.event_add(name, uname, runEvent, onlyOn, runOnce);
837
873
  case 7:
838
874
  case "end":
839
- return _context12.stop();
875
+ return _context13.stop();
840
876
  }
841
- }, _callee12, this);
877
+ }, _callee13, this);
842
878
  }))).apply(this, arguments);
843
879
  }
844
880
  /* -------------------------------------------------------------------------- */
@@ -1178,37 +1214,37 @@ var SimpleObject = /*#__PURE__*/function (_MapableObject, _setValue, _setTemp, _
1178
1214
  }
1179
1215
  }, {
1180
1216
  key: "setTemp",
1181
- value: function setTemp(_x21, _x22, _x23) {
1182
- return (_setTemp2 = _setTemp2 || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(obj, key, value) {
1217
+ value: function setTemp(_x22, _x23, _x24) {
1218
+ return (_setTemp2 = _setTemp2 || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(obj, key, value) {
1183
1219
  var sendChanges,
1184
- _args13 = arguments;
1185
- return _regeneratorRuntime().wrap(function _callee13$(_context13) {
1186
- while (1) switch (_context13.prev = _context13.next) {
1220
+ _args14 = arguments;
1221
+ return _regeneratorRuntime().wrap(function _callee14$(_context14) {
1222
+ while (1) switch (_context14.prev = _context14.next) {
1187
1223
  case 0:
1188
- sendChanges = _args13.length > 3 && _args13[3] !== undefined ? _args13[3] : false;
1224
+ sendChanges = _args14.length > 3 && _args14[3] !== undefined ? _args14[3] : false;
1189
1225
  if (!(_typeof(obj) !== "object" || !obj || Array.isArray(obj))) {
1190
- _context13.next = 3;
1226
+ _context14.next = 3;
1191
1227
  break;
1192
1228
  }
1193
- return _context13.abrupt("return");
1229
+ return _context14.abrupt("return");
1194
1230
  case 3:
1195
1231
  if (!(obj instanceof SimpleObject)) {
1196
- _context13.next = 7;
1232
+ _context14.next = 7;
1197
1233
  break;
1198
1234
  }
1199
- _context13.next = 6;
1235
+ _context14.next = 6;
1200
1236
  return obj.setTemp(key, value, sendChanges);
1201
1237
  case 6:
1202
- return _context13.abrupt("return", _context13.sent);
1238
+ return _context14.abrupt("return", _context14.sent);
1203
1239
  case 7:
1204
1240
  //
1205
1241
  if (obj.__temp == null) obj.__temp = {};
1206
1242
  (0, _object.object_set)(obj.__temp, key, value);
1207
1243
  case 9:
1208
1244
  case "end":
1209
- return _context13.stop();
1245
+ return _context14.stop();
1210
1246
  }
1211
- }, _callee13);
1247
+ }, _callee14);
1212
1248
  }))).apply(this, arguments);
1213
1249
  }
1214
1250
  }, {
@@ -1219,36 +1255,36 @@ var SimpleObject = /*#__PURE__*/function (_MapableObject, _setValue, _setTemp, _
1219
1255
  }
1220
1256
  }, {
1221
1257
  key: "delete_cache",
1222
- value: function delete_cache(_x24) {
1223
- return (_delete_cache = _delete_cache || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(context) {
1258
+ value: function delete_cache(_x25) {
1259
+ return (_delete_cache = _delete_cache || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(context) {
1224
1260
  var cacheKey;
1225
- return _regeneratorRuntime().wrap(function _callee14$(_context14) {
1226
- while (1) switch (_context14.prev = _context14.next) {
1261
+ return _regeneratorRuntime().wrap(function _callee15$(_context15) {
1262
+ while (1) switch (_context15.prev = _context15.next) {
1227
1263
  case 0:
1228
1264
  if (this.__cache_name) {
1229
- _context14.next = 2;
1265
+ _context15.next = 2;
1230
1266
  break;
1231
1267
  }
1232
- return _context14.abrupt("return");
1268
+ return _context15.abrupt("return");
1233
1269
  case 2:
1234
1270
  if (context) {
1235
- _context14.next = 7;
1271
+ _context15.next = 7;
1236
1272
  break;
1237
1273
  }
1238
- _context14.next = 5;
1274
+ _context15.next = 5;
1239
1275
  return _global.gcache.delete_session_cache(this.__cache_name);
1240
1276
  case 5:
1241
- _context14.next = 10;
1277
+ _context15.next = 10;
1242
1278
  break;
1243
1279
  case 7:
1244
1280
  cacheKey = "".concat(this.__cache_name, "-").concat(context);
1245
- _context14.next = 10;
1281
+ _context15.next = 10;
1246
1282
  return _global.gcache.delete_session_cache(cacheKey);
1247
1283
  case 10:
1248
1284
  case "end":
1249
- return _context14.stop();
1285
+ return _context15.stop();
1250
1286
  }
1251
- }, _callee14, this);
1287
+ }, _callee15, this);
1252
1288
  }))).apply(this, arguments);
1253
1289
  }
1254
1290
  }, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azrico/webobject",
3
- "version": "1.4.118",
3
+ "version": "1.4.119",
4
4
  "description": "Stateful object",
5
5
  "author": "Azrideus",
6
6
  "license": "MIT",