@azrico/webobject 1.5.0 → 1.5.2

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