@azrico/webobject 1.5.0 → 1.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -56,6 +56,15 @@ export declare class SimpleObject extends MapableObject {
56
56
  * @return true if changed , false otherwise
57
57
  */
58
58
  setValue(key: WriteablePropOf<this>, value: any, shouldNotify?: sendChangesType): Promise<boolean>;
59
+ /**
60
+ * set value and run the event handlers if needed
61
+ *
62
+ * if the field is not in delta instantly calls the `apply` function to remove from delta
63
+ * @param key
64
+ * @param value
65
+ * @param shouldNotify
66
+ */
67
+ setPreferApply(key: WriteablePropOf<this>, value: any, shouldNotify?: sendChangesType): Promise<boolean>;
59
68
  /**
60
69
  * set value and run the event handlers if needed
61
70
  * @return true if changed , false otherwise
@@ -184,6 +184,47 @@ var SimpleObject = exports.SimpleObject = /*#__PURE__*/function (_MapableObject)
184
184
  return _setValue.apply(this, arguments);
185
185
  }
186
186
  return setValue;
187
+ }()
188
+ /**
189
+ * set value and run the event handlers if needed
190
+ *
191
+ * if the field is not in delta instantly calls the `apply` function to remove from delta
192
+ * @param key
193
+ * @param value
194
+ * @param shouldNotify
195
+ */
196
+ )
197
+ }, {
198
+ key: "setPreferApply",
199
+ value: (function () {
200
+ var _setPreferApply = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(key, value) {
201
+ var shouldNotify,
202
+ keyExists,
203
+ res,
204
+ _args2 = arguments;
205
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
206
+ while (1) switch (_context2.prev = _context2.next) {
207
+ case 0:
208
+ shouldNotify = _args2.length > 2 && _args2[2] !== undefined ? _args2[2] : "auto";
209
+ keyExists = key in this.__delta;
210
+ _context2.next = 4;
211
+ return this.set(key, value, shouldNotify);
212
+ case 4:
213
+ res = _context2.sent;
214
+ if (!keyExists) {
215
+ this.apply(key);
216
+ }
217
+ return _context2.abrupt("return", res);
218
+ case 7:
219
+ case "end":
220
+ return _context2.stop();
221
+ }
222
+ }, _callee2, this);
223
+ }));
224
+ function setPreferApply(_x3, _x4) {
225
+ return _setPreferApply.apply(this, arguments);
226
+ }
227
+ return setPreferApply;
187
228
  }())
188
229
  }, {
189
230
  key: "loadValues",
@@ -203,33 +244,33 @@ var SimpleObject = exports.SimpleObject = /*#__PURE__*/function (_MapableObject)
203
244
  }, {
204
245
  key: "setTemp",
205
246
  value: function () {
206
- var _setTemp = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(key, value) {
247
+ var _setTemp = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(key, value) {
207
248
  var sendChanges,
208
249
  isValueChanged,
209
- _args2 = arguments;
210
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
211
- while (1) switch (_context2.prev = _context2.next) {
250
+ _args3 = arguments;
251
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
252
+ while (1) switch (_context3.prev = _context3.next) {
212
253
  case 0:
213
- sendChanges = _args2.length > 2 && _args2[2] !== undefined ? _args2[2] : false;
214
- _context2.next = 3;
254
+ sendChanges = _args3.length > 2 && _args3[2] !== undefined ? _args3[2] : false;
255
+ _context3.next = 3;
215
256
  return _get(_getPrototypeOf(SimpleObject.prototype), "setTemp", this).call(this, key, value);
216
257
  case 3:
217
- isValueChanged = _context2.sent;
258
+ isValueChanged = _context3.sent;
218
259
  if (!(sendChanges === true || sendChanges === "auto" && isValueChanged)) {
219
- _context2.next = 7;
260
+ _context3.next = 7;
220
261
  break;
221
262
  }
222
- _context2.next = 7;
263
+ _context3.next = 7;
223
264
  return this.notifyChanged("temp", key, value);
224
265
  case 7:
225
- return _context2.abrupt("return", isValueChanged);
266
+ return _context3.abrupt("return", isValueChanged);
226
267
  case 8:
227
268
  case "end":
228
- return _context2.stop();
269
+ return _context3.stop();
229
270
  }
230
- }, _callee2, this);
271
+ }, _callee3, this);
231
272
  }));
232
- function setTemp(_x3, _x4) {
273
+ function setTemp(_x5, _x6) {
233
274
  return _setTemp.apply(this, arguments);
234
275
  }
235
276
  return setTemp;
@@ -237,16 +278,16 @@ var SimpleObject = exports.SimpleObject = /*#__PURE__*/function (_MapableObject)
237
278
  }, {
238
279
  key: "clearRefreshFunction",
239
280
  value: (function () {
240
- var _clearRefreshFunction = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
241
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
242
- while (1) switch (_context3.prev = _context3.next) {
281
+ var _clearRefreshFunction = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
282
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
283
+ while (1) switch (_context4.prev = _context4.next) {
243
284
  case 0:
244
285
  this.__refresh_functions = undefined;
245
286
  case 1:
246
287
  case "end":
247
- return _context3.stop();
288
+ return _context4.stop();
248
289
  }
249
- }, _callee3, this);
290
+ }, _callee4, this);
250
291
  }));
251
292
  function clearRefreshFunction() {
252
293
  return _clearRefreshFunction.apply(this, arguments);
@@ -256,21 +297,21 @@ var SimpleObject = exports.SimpleObject = /*#__PURE__*/function (_MapableObject)
256
297
  }, {
257
298
  key: "setRefreshFunction",
258
299
  value: function () {
259
- var _setRefreshFunction = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(new_fnc) {
260
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
261
- while (1) switch (_context4.prev = _context4.next) {
300
+ var _setRefreshFunction = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(new_fnc) {
301
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
302
+ while (1) switch (_context5.prev = _context5.next) {
262
303
  case 0:
263
- _context4.next = 2;
304
+ _context5.next = 2;
264
305
  return this.addRefreshFunction(new_fnc);
265
306
  case 2:
266
- return _context4.abrupt("return", _context4.sent);
307
+ return _context5.abrupt("return", _context5.sent);
267
308
  case 3:
268
309
  case "end":
269
- return _context4.stop();
310
+ return _context5.stop();
270
311
  }
271
- }, _callee4, this);
312
+ }, _callee5, this);
272
313
  }));
273
- function setRefreshFunction(_x5) {
314
+ function setRefreshFunction(_x7) {
274
315
  return _setRefreshFunction.apply(this, arguments);
275
316
  }
276
317
  return setRefreshFunction;
@@ -278,10 +319,10 @@ var SimpleObject = exports.SimpleObject = /*#__PURE__*/function (_MapableObject)
278
319
  }, {
279
320
  key: "addRefreshFunction",
280
321
  value: function () {
281
- var _addRefreshFunction = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(key, new_fnc) {
322
+ var _addRefreshFunction = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(key, new_fnc) {
282
323
  var oldFunctions;
283
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
284
- while (1) switch (_context5.prev = _context5.next) {
324
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
325
+ while (1) switch (_context6.prev = _context6.next) {
285
326
  case 0:
286
327
  if (typeof key === "function") {
287
328
  new_fnc = key;
@@ -294,11 +335,11 @@ var SimpleObject = exports.SimpleObject = /*#__PURE__*/function (_MapableObject)
294
335
  this.__refresh_functions = oldFunctions;
295
336
  case 6:
296
337
  case "end":
297
- return _context5.stop();
338
+ return _context6.stop();
298
339
  }
299
- }, _callee5, this);
340
+ }, _callee6, this);
300
341
  }));
301
- function addRefreshFunction(_x6, _x7) {
342
+ function addRefreshFunction(_x8, _x9) {
302
343
  return _addRefreshFunction.apply(this, arguments);
303
344
  }
304
345
  return addRefreshFunction;
@@ -306,7 +347,7 @@ var SimpleObject = exports.SimpleObject = /*#__PURE__*/function (_MapableObject)
306
347
  }, {
307
348
  key: "runRefreshFunction",
308
349
  value: function () {
309
- var _runRefreshFunction = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
350
+ var _runRefreshFunction = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
310
351
  var oldFunctions,
311
352
  fncArray,
312
353
  _len,
@@ -314,39 +355,39 @@ var SimpleObject = exports.SimpleObject = /*#__PURE__*/function (_MapableObject)
314
355
  _key,
315
356
  index,
316
357
  fnc,
317
- _args6 = arguments;
318
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
319
- while (1) switch (_context6.prev = _context6.next) {
358
+ _args7 = arguments;
359
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
360
+ while (1) switch (_context7.prev = _context7.next) {
320
361
  case 0:
321
362
  oldFunctions = this.__refresh_functions;
322
363
  if (!(oldFunctions == null || _typeof(oldFunctions) !== "object")) {
323
- _context6.next = 3;
364
+ _context7.next = 3;
324
365
  break;
325
366
  }
326
- return _context6.abrupt("return");
367
+ return _context7.abrupt("return");
327
368
  case 3:
328
369
  fncArray = Object.values(oldFunctions);
329
- for (_len = _args6.length, params = new Array(_len), _key = 0; _key < _len; _key++) {
330
- params[_key] = _args6[_key];
370
+ for (_len = _args7.length, params = new Array(_len), _key = 0; _key < _len; _key++) {
371
+ params[_key] = _args7[_key];
331
372
  }
332
373
  index = 0;
333
374
  case 6:
334
375
  if (!(index < fncArray.length)) {
335
- _context6.next = 13;
376
+ _context7.next = 13;
336
377
  break;
337
378
  }
338
379
  fnc = fncArray[index];
339
- _context6.next = 10;
380
+ _context7.next = 10;
340
381
  return _object.fn_eval.apply(void 0, [fnc].concat(params));
341
382
  case 10:
342
383
  index++;
343
- _context6.next = 6;
384
+ _context7.next = 6;
344
385
  break;
345
386
  case 13:
346
387
  case "end":
347
- return _context6.stop();
388
+ return _context7.stop();
348
389
  }
349
- }, _callee6, this);
390
+ }, _callee7, this);
350
391
  }));
351
392
  function runRefreshFunction() {
352
393
  return _runRefreshFunction.apply(this, arguments);
@@ -363,47 +404,47 @@ var SimpleObject = exports.SimpleObject = /*#__PURE__*/function (_MapableObject)
363
404
  }, {
364
405
  key: "setAll",
365
406
  value: (function () {
366
- var _setAll = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(setObj) {
407
+ var _setAll = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(setObj) {
367
408
  var changeablesOnly,
368
409
  finalRes,
369
410
  checkKeys,
370
411
  index,
371
412
  key,
372
- _args7 = arguments;
373
- return _regeneratorRuntime().wrap(function _callee7$(_context7) {
374
- while (1) switch (_context7.prev = _context7.next) {
413
+ _args8 = arguments;
414
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
415
+ while (1) switch (_context8.prev = _context8.next) {
375
416
  case 0:
376
- changeablesOnly = _args7.length > 1 && _args7[1] !== undefined ? _args7[1] : true;
417
+ changeablesOnly = _args8.length > 1 && _args8[1] !== undefined ? _args8[1] : true;
377
418
  finalRes = true;
378
419
  checkKeys = changeablesOnly ? (0, _object.array_intersection)(this.__changeables, Object.keys(setObj)) : Object.keys(setObj);
379
420
  index = 0;
380
421
  case 4:
381
422
  if (!(index < checkKeys.length)) {
382
- _context7.next = 13;
423
+ _context8.next = 13;
383
424
  break;
384
425
  }
385
426
  key = checkKeys[index];
386
- _context7.next = 8;
427
+ _context8.next = 8;
387
428
  return this.setValue(key, setObj[key]);
388
429
  case 8:
389
- if (_context7.sent) {
390
- _context7.next = 10;
430
+ if (_context8.sent) {
431
+ _context8.next = 10;
391
432
  break;
392
433
  }
393
434
  finalRes = false;
394
435
  case 10:
395
436
  index++;
396
- _context7.next = 4;
437
+ _context8.next = 4;
397
438
  break;
398
439
  case 13:
399
- return _context7.abrupt("return", finalRes);
440
+ return _context8.abrupt("return", finalRes);
400
441
  case 14:
401
442
  case "end":
402
- return _context7.stop();
443
+ return _context8.stop();
403
444
  }
404
- }, _callee7, this);
445
+ }, _callee8, this);
405
446
  }));
406
- function setAll(_x8) {
447
+ function setAll(_x10) {
407
448
  return _setAll.apply(this, arguments);
408
449
  }
409
450
  return setAll;
@@ -431,29 +472,29 @@ var SimpleObject = exports.SimpleObject = /*#__PURE__*/function (_MapableObject)
431
472
  * @return true if changed , false otherwise
432
473
  */
433
474
  function () {
434
- var _setSubValue = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(key, objKey, subvalue) {
475
+ var _setSubValue = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(key, objKey, subvalue) {
435
476
  var sendChanges,
436
477
  isValueChanged,
437
478
  subval,
438
- _args8 = arguments;
439
- return _regeneratorRuntime().wrap(function _callee8$(_context8) {
440
- while (1) switch (_context8.prev = _context8.next) {
479
+ _args9 = arguments;
480
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
481
+ while (1) switch (_context9.prev = _context9.next) {
441
482
  case 0:
442
- sendChanges = _args8.length > 3 && _args8[3] !== undefined ? _args8[3] : "auto";
483
+ sendChanges = _args9.length > 3 && _args9[3] !== undefined ? _args9[3] : "auto";
443
484
  if (this.canModify) {
444
- _context8.next = 7;
485
+ _context9.next = 7;
445
486
  break;
446
487
  }
447
488
  if (!(this.__throw_errors !== false)) {
448
- _context8.next = 6;
489
+ _context9.next = 6;
449
490
  break;
450
491
  }
451
492
  throw Error("Cant use setSubValue (".concat(String(key), ") when on readonly mode"));
452
493
  case 6:
453
- return _context8.abrupt("return", false);
494
+ return _context9.abrupt("return", false);
454
495
  case 7:
455
496
  isValueChanged = false;
456
- _context8.prev = 8;
497
+ _context9.prev = 8;
457
498
  //if accessing subval of an object, make sure the object is not null
458
499
  subval = _assertClassBrand(_SimpleObject_brand, this, _getSubProperty).call(this, key, objKey);
459
500
  if (!(0, _object.object_equals)(subval, subvalue, {
@@ -464,24 +505,24 @@ var SimpleObject = exports.SimpleObject = /*#__PURE__*/function (_MapableObject)
464
505
  isValueChanged = true;
465
506
  } else isValueChanged = false;
466
507
  case 11:
467
- _context8.prev = 11;
508
+ _context9.prev = 11;
468
509
  if (!(sendChanges === true || sendChanges === "auto" && isValueChanged)) {
469
- _context8.next = 15;
510
+ _context9.next = 15;
470
511
  break;
471
512
  }
472
- _context8.next = 15;
513
+ _context9.next = 15;
473
514
  return this.notifyChanged("", key, objKey, subvalue);
474
515
  case 15:
475
- return _context8.finish(11);
516
+ return _context9.finish(11);
476
517
  case 16:
477
- return _context8.abrupt("return", isValueChanged);
518
+ return _context9.abrupt("return", isValueChanged);
478
519
  case 17:
479
520
  case "end":
480
- return _context8.stop();
521
+ return _context9.stop();
481
522
  }
482
- }, _callee8, this, [[8,, 11, 16]]);
523
+ }, _callee9, this, [[8,, 11, 16]]);
483
524
  }));
484
- function setSubValue(_x9, _x10, _x11) {
525
+ function setSubValue(_x11, _x12, _x13) {
485
526
  return _setSubValue.apply(this, arguments);
486
527
  }
487
528
  return setSubValue;
@@ -497,24 +538,24 @@ var SimpleObject = exports.SimpleObject = /*#__PURE__*/function (_MapableObject)
497
538
  * @returns
498
539
  */
499
540
  function () {
500
- var _pushValue = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(key, value) {
541
+ var _pushValue = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(key, value) {
501
542
  var sendChanges,
502
- _args9 = arguments;
503
- return _regeneratorRuntime().wrap(function _callee9$(_context9) {
504
- while (1) switch (_context9.prev = _context9.next) {
543
+ _args10 = arguments;
544
+ return _regeneratorRuntime().wrap(function _callee10$(_context10) {
545
+ while (1) switch (_context10.prev = _context10.next) {
505
546
  case 0:
506
- sendChanges = _args9.length > 2 && _args9[2] !== undefined ? _args9[2] : "auto";
507
- _context9.next = 3;
547
+ sendChanges = _args10.length > 2 && _args10[2] !== undefined ? _args10[2] : "auto";
548
+ _context10.next = 3;
508
549
  return this.pushValues(key, [value], sendChanges);
509
550
  case 3:
510
- return _context9.abrupt("return", _context9.sent);
551
+ return _context10.abrupt("return", _context10.sent);
511
552
  case 4:
512
553
  case "end":
513
- return _context9.stop();
554
+ return _context10.stop();
514
555
  }
515
- }, _callee9, this);
556
+ }, _callee10, this);
516
557
  }));
517
- function pushValue(_x12, _x13) {
558
+ function pushValue(_x14, _x15) {
518
559
  return _pushValue.apply(this, arguments);
519
560
  }
520
561
  return pushValue;
@@ -530,62 +571,62 @@ var SimpleObject = exports.SimpleObject = /*#__PURE__*/function (_MapableObject)
530
571
  }, {
531
572
  key: "pushValues",
532
573
  value: (function () {
533
- var _pushValues = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(key, values) {
574
+ var _pushValues = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(key, values) {
534
575
  var sendChanges,
535
576
  tempArray,
536
- _args10 = arguments;
537
- return _regeneratorRuntime().wrap(function _callee10$(_context10) {
538
- while (1) switch (_context10.prev = _context10.next) {
577
+ _args11 = arguments;
578
+ return _regeneratorRuntime().wrap(function _callee11$(_context11) {
579
+ while (1) switch (_context11.prev = _context11.next) {
539
580
  case 0:
540
- sendChanges = _args10.length > 2 && _args10[2] !== undefined ? _args10[2] : "auto";
581
+ sendChanges = _args11.length > 2 && _args11[2] !== undefined ? _args11[2] : "auto";
541
582
  if (!(0, _object.array_isEmpty)(values)) {
542
- _context10.next = 3;
583
+ _context11.next = 3;
543
584
  break;
544
585
  }
545
- return _context10.abrupt("return", false);
586
+ return _context11.abrupt("return", false);
546
587
  case 3:
547
588
  if (this.canModify) {
548
- _context10.next = 9;
589
+ _context11.next = 9;
549
590
  break;
550
591
  }
551
592
  if (!(this.__throw_errors !== false)) {
552
- _context10.next = 8;
593
+ _context11.next = 8;
553
594
  break;
554
595
  }
555
596
  throw Error("Cant use pushValues (".concat(String(key), ") when on readonly mode"));
556
597
  case 8:
557
- return _context10.abrupt("return", false);
598
+ return _context11.abrupt("return", false);
558
599
  case 9:
559
600
  if (_assertClassBrand(_SimpleObject_brand, this, _getProperty).call(this, key) == null) _assertClassBrand(_SimpleObject_brand, this, _setProperty).call(this, key, []);
560
601
  tempArray = _assertClassBrand(_SimpleObject_brand, this, _getProperty).call(this, key);
561
602
  if (Array.isArray(tempArray)) {
562
- _context10.next = 17;
603
+ _context11.next = 17;
563
604
  break;
564
605
  }
565
606
  if (!(this.__throw_errors !== false)) {
566
- _context10.next = 16;
607
+ _context11.next = 16;
567
608
  break;
568
609
  }
569
610
  throw Error("Cant use pushValues (".concat(String(key), ") on non Array keys"));
570
611
  case 16:
571
- return _context10.abrupt("return", false);
612
+ return _context11.abrupt("return", false);
572
613
  case 17:
573
614
  _assertClassBrand(_SimpleObject_brand, this, _setProperty).call(this, key, (0, _object.array_merge)(tempArray, values));
574
615
  if (!(sendChanges === true || sendChanges === "auto")) {
575
- _context10.next = 21;
616
+ _context11.next = 21;
576
617
  break;
577
618
  }
578
- _context10.next = 21;
619
+ _context11.next = 21;
579
620
  return this.notifyChanged("", key, values);
580
621
  case 21:
581
- return _context10.abrupt("return", tempArray);
622
+ return _context11.abrupt("return", tempArray);
582
623
  case 22:
583
624
  case "end":
584
- return _context10.stop();
625
+ return _context11.stop();
585
626
  }
586
- }, _callee10, this);
627
+ }, _callee11, this);
587
628
  }));
588
- function pushValues(_x14, _x15) {
629
+ function pushValues(_x16, _x17) {
589
630
  return _pushValues.apply(this, arguments);
590
631
  }
591
632
  return pushValues;
@@ -602,10 +643,10 @@ var SimpleObject = exports.SimpleObject = /*#__PURE__*/function (_MapableObject)
602
643
  }, {
603
644
  key: "notifyChanged",
604
645
  value: (function () {
605
- var _notifyChanged = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(type, key, value, subvalue) {
646
+ var _notifyChanged = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(type, key, value, subvalue) {
606
647
  var lc, manager_class;
607
- return _regeneratorRuntime().wrap(function _callee11$(_context11) {
608
- while (1) switch (_context11.prev = _context11.next) {
648
+ return _regeneratorRuntime().wrap(function _callee12$(_context12) {
649
+ while (1) switch (_context12.prev = _context12.next) {
609
650
  case 0:
610
651
  if (value === undefined && type == "") value = this.getValue(key);
611
652
  lc = "";
@@ -619,22 +660,22 @@ var SimpleObject = exports.SimpleObject = /*#__PURE__*/function (_MapableObject)
619
660
  /* --------------------------- notify the manager --------------------------- */
620
661
  manager_class = this.manager;
621
662
  if (!(typeof (manager_class === null || manager_class === void 0 ? void 0 : manager_class.notifyChanged) === "function")) {
622
- _context11.next = 10;
663
+ _context12.next = 10;
623
664
  break;
624
665
  }
625
- _context11.next = 9;
666
+ _context12.next = 9;
626
667
  return manager_class.notifyChanged(type, key, value, subvalue);
627
668
  case 9:
628
- return _context11.abrupt("return", _context11.sent);
669
+ return _context12.abrupt("return", _context12.sent);
629
670
  case 10:
630
- return _context11.abrupt("return", false);
671
+ return _context12.abrupt("return", false);
631
672
  case 11:
632
673
  case "end":
633
- return _context11.stop();
674
+ return _context12.stop();
634
675
  }
635
- }, _callee11, this);
676
+ }, _callee12, this);
636
677
  }));
637
- function notifyChanged(_x16, _x17, _x18, _x19) {
678
+ function notifyChanged(_x18, _x19, _x20, _x21) {
638
679
  return _notifyChanged.apply(this, arguments);
639
680
  }
640
681
  return notifyChanged;
@@ -698,24 +739,24 @@ var SimpleObject = exports.SimpleObject = /*#__PURE__*/function (_MapableObject)
698
739
  }, {
699
740
  key: "reset",
700
741
  value: (function () {
701
- var _reset = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(key) {
742
+ var _reset = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(key) {
702
743
  var shouldNotify,
703
- _args12 = arguments;
704
- return _regeneratorRuntime().wrap(function _callee12$(_context12) {
705
- while (1) switch (_context12.prev = _context12.next) {
744
+ _args13 = arguments;
745
+ return _regeneratorRuntime().wrap(function _callee13$(_context13) {
746
+ while (1) switch (_context13.prev = _context13.next) {
706
747
  case 0:
707
- shouldNotify = _args12.length > 1 && _args12[1] !== undefined ? _args12[1] : "auto";
708
- _context12.next = 3;
748
+ shouldNotify = _args13.length > 1 && _args13[1] !== undefined ? _args13[1] : "auto";
749
+ _context13.next = 3;
709
750
  return this.setValue(key, this[key], shouldNotify);
710
751
  case 3:
711
- return _context12.abrupt("return", _context12.sent);
752
+ return _context13.abrupt("return", _context13.sent);
712
753
  case 4:
713
754
  case "end":
714
- return _context12.stop();
755
+ return _context13.stop();
715
756
  }
716
- }, _callee12, this);
757
+ }, _callee13, this);
717
758
  }));
718
- function reset(_x20) {
759
+ function reset(_x22) {
719
760
  return _reset.apply(this, arguments);
720
761
  }
721
762
  return reset;
@@ -729,43 +770,43 @@ var SimpleObject = exports.SimpleObject = /*#__PURE__*/function (_MapableObject)
729
770
  }, {
730
771
  key: "resetAll",
731
772
  value: (function () {
732
- var _resetAll = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
773
+ var _resetAll = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
733
774
  var shouldNotify,
734
775
  fr,
735
776
  key,
736
- _args13 = arguments;
737
- return _regeneratorRuntime().wrap(function _callee13$(_context13) {
738
- while (1) switch (_context13.prev = _context13.next) {
777
+ _args14 = arguments;
778
+ return _regeneratorRuntime().wrap(function _callee14$(_context14) {
779
+ while (1) switch (_context14.prev = _context14.next) {
739
780
  case 0:
740
- shouldNotify = _args13.length > 0 && _args13[0] !== undefined ? _args13[0] : "auto";
781
+ shouldNotify = _args14.length > 0 && _args14[0] !== undefined ? _args14[0] : "auto";
741
782
  fr = true;
742
- _context13.t0 = _regeneratorRuntime().keys(this.__delta);
783
+ _context14.t0 = _regeneratorRuntime().keys(this.__delta);
743
784
  case 3:
744
- if ((_context13.t1 = _context13.t0()).done) {
745
- _context13.next = 13;
785
+ if ((_context14.t1 = _context14.t0()).done) {
786
+ _context14.next = 13;
746
787
  break;
747
788
  }
748
- key = _context13.t1.value;
749
- _context13.t2 = fr;
750
- if (!_context13.t2) {
751
- _context13.next = 10;
789
+ key = _context14.t1.value;
790
+ _context14.t2 = fr;
791
+ if (!_context14.t2) {
792
+ _context14.next = 10;
752
793
  break;
753
794
  }
754
- _context13.next = 9;
795
+ _context14.next = 9;
755
796
  return this.reset(key, shouldNotify);
756
797
  case 9:
757
- _context13.t2 = _context13.sent;
798
+ _context14.t2 = _context14.sent;
758
799
  case 10:
759
- fr = _context13.t2;
760
- _context13.next = 3;
800
+ fr = _context14.t2;
801
+ _context14.next = 3;
761
802
  break;
762
803
  case 13:
763
- return _context13.abrupt("return", fr);
804
+ return _context14.abrupt("return", fr);
764
805
  case 14:
765
806
  case "end":
766
- return _context13.stop();
807
+ return _context14.stop();
767
808
  }
768
- }, _callee13, this);
809
+ }, _callee14, this);
769
810
  }));
770
811
  function resetAll() {
771
812
  return _resetAll.apply(this, arguments);
@@ -976,36 +1017,36 @@ var SimpleObject = exports.SimpleObject = /*#__PURE__*/function (_MapableObject)
976
1017
  /* Events */
977
1018
  /* -------------------------------------------------------------------------- */
978
1019
  function () {
979
- var _event_run = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(eventName) {
1020
+ var _event_run = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(eventName) {
980
1021
  var _this$manager2;
981
1022
  var _len2,
982
1023
  params,
983
1024
  _key2,
984
- _args14 = arguments;
985
- return _regeneratorRuntime().wrap(function _callee14$(_context14) {
986
- while (1) switch (_context14.prev = _context14.next) {
1025
+ _args15 = arguments;
1026
+ return _regeneratorRuntime().wrap(function _callee15$(_context15) {
1027
+ while (1) switch (_context15.prev = _context15.next) {
987
1028
  case 0:
988
1029
  if (this.manager) {
989
- _context14.next = 3;
1030
+ _context15.next = 3;
990
1031
  break;
991
1032
  }
992
1033
  if (this.__showErrors === true) console.error("you cant use events (".concat(eventName, ") if your object has no manager"));
993
- return _context14.abrupt("return");
1034
+ return _context15.abrupt("return");
994
1035
  case 3:
995
- for (_len2 = _args14.length, params = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
996
- params[_key2 - 1] = _args14[_key2];
1036
+ for (_len2 = _args15.length, params = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
1037
+ params[_key2 - 1] = _args15[_key2];
997
1038
  }
998
- _context14.next = 6;
1039
+ _context15.next = 6;
999
1040
  return (_this$manager2 = this.manager).event_run.apply(_this$manager2, [eventName].concat(params));
1000
1041
  case 6:
1001
- return _context14.abrupt("return", _context14.sent);
1042
+ return _context15.abrupt("return", _context15.sent);
1002
1043
  case 7:
1003
1044
  case "end":
1004
- return _context14.stop();
1045
+ return _context15.stop();
1005
1046
  }
1006
- }, _callee14, this);
1047
+ }, _callee15, this);
1007
1048
  }));
1008
- function event_run(_x21) {
1049
+ function event_run(_x23) {
1009
1050
  return _event_run.apply(this, arguments);
1010
1051
  }
1011
1052
  return event_run;
@@ -1033,31 +1074,31 @@ var SimpleObject = exports.SimpleObject = /*#__PURE__*/function (_MapableObject)
1033
1074
  }, {
1034
1075
  key: "event_add",
1035
1076
  value: function () {
1036
- var _event_add = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(name, uname, runEvent) {
1077
+ var _event_add = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(name, uname, runEvent) {
1037
1078
  var onlyOn,
1038
1079
  runOnce,
1039
- _args15 = arguments;
1040
- return _regeneratorRuntime().wrap(function _callee15$(_context15) {
1041
- while (1) switch (_context15.prev = _context15.next) {
1080
+ _args16 = arguments;
1081
+ return _regeneratorRuntime().wrap(function _callee16$(_context16) {
1082
+ while (1) switch (_context16.prev = _context16.next) {
1042
1083
  case 0:
1043
- onlyOn = _args15.length > 3 && _args15[3] !== undefined ? _args15[3] : null;
1044
- runOnce = _args15.length > 4 && _args15[4] !== undefined ? _args15[4] : false;
1084
+ onlyOn = _args16.length > 3 && _args16[3] !== undefined ? _args16[3] : null;
1085
+ runOnce = _args16.length > 4 && _args16[4] !== undefined ? _args16[4] : false;
1045
1086
  if (this.manager) {
1046
- _context15.next = 5;
1087
+ _context16.next = 5;
1047
1088
  break;
1048
1089
  }
1049
1090
  if (this.__showErrors === true) console.error("you cant use events (".concat(name, ") if your object has no manager"));
1050
- return _context15.abrupt("return");
1091
+ return _context16.abrupt("return");
1051
1092
  case 5:
1052
- _context15.next = 7;
1093
+ _context16.next = 7;
1053
1094
  return this.manager.event_add(name, uname, runEvent, onlyOn, runOnce);
1054
1095
  case 7:
1055
1096
  case "end":
1056
- return _context15.stop();
1097
+ return _context16.stop();
1057
1098
  }
1058
- }, _callee15, this);
1099
+ }, _callee16, this);
1059
1100
  }));
1060
- function event_add(_x22, _x23, _x24) {
1101
+ function event_add(_x24, _x25, _x26) {
1061
1102
  return _event_add.apply(this, arguments);
1062
1103
  }
1063
1104
  return event_add;
@@ -1461,38 +1502,38 @@ var SimpleObject = exports.SimpleObject = /*#__PURE__*/function (_MapableObject)
1461
1502
  }, {
1462
1503
  key: "setTemp",
1463
1504
  value: (function () {
1464
- var _setTemp2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(obj, key, value) {
1505
+ var _setTemp2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(obj, key, value) {
1465
1506
  var sendChanges,
1466
- _args16 = arguments;
1467
- return _regeneratorRuntime().wrap(function _callee16$(_context16) {
1468
- while (1) switch (_context16.prev = _context16.next) {
1507
+ _args17 = arguments;
1508
+ return _regeneratorRuntime().wrap(function _callee17$(_context17) {
1509
+ while (1) switch (_context17.prev = _context17.next) {
1469
1510
  case 0:
1470
- sendChanges = _args16.length > 3 && _args16[3] !== undefined ? _args16[3] : false;
1511
+ sendChanges = _args17.length > 3 && _args17[3] !== undefined ? _args17[3] : false;
1471
1512
  if (!(_typeof(obj) !== "object" || !obj || Array.isArray(obj))) {
1472
- _context16.next = 3;
1513
+ _context17.next = 3;
1473
1514
  break;
1474
1515
  }
1475
- return _context16.abrupt("return");
1516
+ return _context17.abrupt("return");
1476
1517
  case 3:
1477
1518
  if (!(obj instanceof SimpleObject)) {
1478
- _context16.next = 7;
1519
+ _context17.next = 7;
1479
1520
  break;
1480
1521
  }
1481
- _context16.next = 6;
1522
+ _context17.next = 6;
1482
1523
  return obj.setTemp(key, value, sendChanges);
1483
1524
  case 6:
1484
- return _context16.abrupt("return", _context16.sent);
1525
+ return _context17.abrupt("return", _context17.sent);
1485
1526
  case 7:
1486
1527
  //
1487
1528
  if (obj.__temp == null) obj.__temp = {};
1488
1529
  (0, _object.object_set)(obj.__temp, key, value);
1489
1530
  case 9:
1490
1531
  case "end":
1491
- return _context16.stop();
1532
+ return _context17.stop();
1492
1533
  }
1493
- }, _callee16);
1534
+ }, _callee17);
1494
1535
  }));
1495
- function setTemp(_x25, _x26, _x27) {
1536
+ function setTemp(_x27, _x28, _x29) {
1496
1537
  return _setTemp2.apply(this, arguments);
1497
1538
  }
1498
1539
  return setTemp;
@@ -1506,37 +1547,37 @@ var SimpleObject = exports.SimpleObject = /*#__PURE__*/function (_MapableObject)
1506
1547
  }, {
1507
1548
  key: "delete_cache",
1508
1549
  value: function () {
1509
- var _delete_cache = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(context) {
1550
+ var _delete_cache = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(context) {
1510
1551
  var cacheKey;
1511
- return _regeneratorRuntime().wrap(function _callee17$(_context17) {
1512
- while (1) switch (_context17.prev = _context17.next) {
1552
+ return _regeneratorRuntime().wrap(function _callee18$(_context18) {
1553
+ while (1) switch (_context18.prev = _context18.next) {
1513
1554
  case 0:
1514
1555
  if (this.__db_name) {
1515
- _context17.next = 2;
1556
+ _context18.next = 2;
1516
1557
  break;
1517
1558
  }
1518
- return _context17.abrupt("return");
1559
+ return _context18.abrupt("return");
1519
1560
  case 2:
1520
1561
  if (context) {
1521
- _context17.next = 7;
1562
+ _context18.next = 7;
1522
1563
  break;
1523
1564
  }
1524
- _context17.next = 5;
1565
+ _context18.next = 5;
1525
1566
  return _global.gcache.delete_session_cache(this.__db_name);
1526
1567
  case 5:
1527
- _context17.next = 10;
1568
+ _context18.next = 10;
1528
1569
  break;
1529
1570
  case 7:
1530
1571
  cacheKey = "".concat(this.__db_name, "-").concat(context);
1531
- _context17.next = 10;
1572
+ _context18.next = 10;
1532
1573
  return _global.gcache.delete_session_cache(cacheKey);
1533
1574
  case 10:
1534
1575
  case "end":
1535
- return _context17.stop();
1576
+ return _context18.stop();
1536
1577
  }
1537
- }, _callee17, this);
1578
+ }, _callee18, this);
1538
1579
  }));
1539
- function delete_cache(_x28) {
1580
+ function delete_cache(_x30) {
1540
1581
  return _delete_cache.apply(this, arguments);
1541
1582
  }
1542
1583
  return delete_cache;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azrico/webobject",
3
- "version": "1.5.0",
3
+ "version": "1.5.1",
4
4
  "description": "Stateful object",
5
5
  "author": "Azrideus",
6
6
  "license": "MIT",