@azrico/webobject 1.4.74 → 1.4.77

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.
@@ -54,7 +54,7 @@ export declare class ObjectManager<ObjType extends SimpleObject> {
54
54
  setSubValue(key: PropOf<ObjType>, objKey: string, subvalue: any): Promise<boolean>;
55
55
  pushValue(key: PropOf<ObjType>, value: any): Promise<false | NonNullable<Awaited<ObjType[any]>>>;
56
56
  setTemp(key: string, value: any, sendChanges?: sendChangesType): Promise<boolean>;
57
- getTemp(key: string): Promise<any>;
57
+ getTemp(key: string): any;
58
58
  getIndexOrID(): number | string;
59
59
  getIndex(): number;
60
60
  getID(): string;
@@ -23,7 +23,7 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
23
23
  /**
24
24
  * This class manages the events of an Simple Object
25
25
  */
26
- var ObjectManager = /*#__PURE__*/function (_notifyChanged, _setValue, _setSubValue, _pushValue, _setTemp, _getTemp, _event_run, _event_add, _toggleOption, _setOption, _holdOption) {
26
+ var ObjectManager = /*#__PURE__*/function (_notifyChanged, _setValue, _setSubValue, _pushValue, _setTemp, _event_run, _event_add, _toggleOption, _setOption, _holdOption) {
27
27
  function ObjectManager() {
28
28
  _classCallCheck(this, ObjectManager);
29
29
  _defineProperty(this, "__eventList", void 0);
@@ -224,22 +224,33 @@ var ObjectManager = /*#__PURE__*/function (_notifyChanged, _setValue, _setSubVal
224
224
  key: "setSubValue",
225
225
  value: function setSubValue(_x7, _x8, _x9) {
226
226
  return (_setSubValue = _setSubValue || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(key, objKey, subvalue) {
227
- var _this$obj6;
227
+ var _yield$this$obj$setSu, _this$obj6;
228
228
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
229
229
  while (1) switch (_context3.prev = _context3.next) {
230
230
  case 0:
231
231
  _context3.next = 2;
232
232
  return (_this$obj6 = this.obj) === null || _this$obj6 === void 0 ? void 0 : _this$obj6.setSubValue(key, objKey, subvalue);
233
233
  case 2:
234
- _context3.t0 = _context3.sent;
235
- if (_context3.t0) {
236
- _context3.next = 5;
234
+ _context3.t1 = _yield$this$obj$setSu = _context3.sent;
235
+ _context3.t0 = _context3.t1 !== null;
236
+ if (!_context3.t0) {
237
+ _context3.next = 6;
237
238
  break;
238
239
  }
239
- _context3.t0 = false;
240
- case 5:
241
- return _context3.abrupt("return", _context3.t0);
240
+ _context3.t0 = _yield$this$obj$setSu !== void 0;
242
241
  case 6:
242
+ if (!_context3.t0) {
243
+ _context3.next = 10;
244
+ break;
245
+ }
246
+ _context3.t2 = _yield$this$obj$setSu;
247
+ _context3.next = 11;
248
+ break;
249
+ case 10:
250
+ _context3.t2 = false;
251
+ case 11:
252
+ return _context3.abrupt("return", _context3.t2);
253
+ case 12:
243
254
  case "end":
244
255
  return _context3.stop();
245
256
  }
@@ -250,22 +261,33 @@ var ObjectManager = /*#__PURE__*/function (_notifyChanged, _setValue, _setSubVal
250
261
  key: "pushValue",
251
262
  value: function pushValue(_x10, _x11) {
252
263
  return (_pushValue = _pushValue || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(key, value) {
253
- var _this$obj7;
264
+ var _yield$this$obj$pushV, _this$obj7;
254
265
  return _regeneratorRuntime().wrap(function _callee4$(_context4) {
255
266
  while (1) switch (_context4.prev = _context4.next) {
256
267
  case 0:
257
268
  _context4.next = 2;
258
269
  return (_this$obj7 = this.obj) === null || _this$obj7 === void 0 ? void 0 : _this$obj7.pushValue(key, value);
259
270
  case 2:
260
- _context4.t0 = _context4.sent;
261
- if (_context4.t0) {
262
- _context4.next = 5;
271
+ _context4.t1 = _yield$this$obj$pushV = _context4.sent;
272
+ _context4.t0 = _context4.t1 !== null;
273
+ if (!_context4.t0) {
274
+ _context4.next = 6;
263
275
  break;
264
276
  }
265
- _context4.t0 = false;
266
- case 5:
267
- return _context4.abrupt("return", _context4.t0);
277
+ _context4.t0 = _yield$this$obj$pushV !== void 0;
268
278
  case 6:
279
+ if (!_context4.t0) {
280
+ _context4.next = 10;
281
+ break;
282
+ }
283
+ _context4.t2 = _yield$this$obj$pushV;
284
+ _context4.next = 11;
285
+ break;
286
+ case 10:
287
+ _context4.t2 = false;
288
+ case 11:
289
+ return _context4.abrupt("return", _context4.t2);
290
+ case 12:
269
291
  case "end":
270
292
  return _context4.stop();
271
293
  }
@@ -276,7 +298,7 @@ var ObjectManager = /*#__PURE__*/function (_notifyChanged, _setValue, _setSubVal
276
298
  key: "setTemp",
277
299
  value: function setTemp(_x12, _x13) {
278
300
  return (_setTemp = _setTemp || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(key, value) {
279
- var _this$obj8;
301
+ var _yield$this$obj$setTe, _this$obj8;
280
302
  var sendChanges,
281
303
  _args5 = arguments;
282
304
  return _regeneratorRuntime().wrap(function _callee5$(_context5) {
@@ -286,15 +308,26 @@ var ObjectManager = /*#__PURE__*/function (_notifyChanged, _setValue, _setSubVal
286
308
  _context5.next = 3;
287
309
  return (_this$obj8 = this.obj) === null || _this$obj8 === void 0 ? void 0 : _this$obj8.setTemp(key, value, sendChanges);
288
310
  case 3:
289
- _context5.t0 = _context5.sent;
290
- if (_context5.t0) {
291
- _context5.next = 6;
311
+ _context5.t1 = _yield$this$obj$setTe = _context5.sent;
312
+ _context5.t0 = _context5.t1 !== null;
313
+ if (!_context5.t0) {
314
+ _context5.next = 7;
292
315
  break;
293
316
  }
294
- _context5.t0 = false;
295
- case 6:
296
- return _context5.abrupt("return", _context5.t0);
317
+ _context5.t0 = _yield$this$obj$setTe !== void 0;
297
318
  case 7:
319
+ if (!_context5.t0) {
320
+ _context5.next = 11;
321
+ break;
322
+ }
323
+ _context5.t2 = _yield$this$obj$setTe;
324
+ _context5.next = 12;
325
+ break;
326
+ case 11:
327
+ _context5.t2 = false;
328
+ case 12:
329
+ return _context5.abrupt("return", _context5.t2);
330
+ case 13:
298
331
  case "end":
299
332
  return _context5.stop();
300
333
  }
@@ -303,30 +336,11 @@ var ObjectManager = /*#__PURE__*/function (_notifyChanged, _setValue, _setSubVal
303
336
  } //get temp value
304
337
  }, {
305
338
  key: "getTemp",
306
- value: function getTemp(_x14) {
307
- return (_getTemp = _getTemp || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(key) {
308
- var _this$obj9;
309
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
310
- while (1) switch (_context6.prev = _context6.next) {
311
- case 0:
312
- _context6.next = 2;
313
- return (_this$obj9 = this.obj) === null || _this$obj9 === void 0 ? void 0 : _this$obj9.getTemp(key);
314
- case 2:
315
- _context6.t0 = _context6.sent;
316
- if (_context6.t0) {
317
- _context6.next = 5;
318
- break;
319
- }
320
- _context6.t0 = false;
321
- case 5:
322
- return _context6.abrupt("return", _context6.t0);
323
- case 6:
324
- case "end":
325
- return _context6.stop();
326
- }
327
- }, _callee6, this);
328
- }))).apply(this, arguments);
329
- } /* -------------------------------------------------------------------------- */
339
+ value: function getTemp(key) {
340
+ var _this$obj$getTemp, _this$obj9;
341
+ return (_this$obj$getTemp = (_this$obj9 = this.obj) === null || _this$obj9 === void 0 ? void 0 : _this$obj9.getTemp(key)) !== null && _this$obj$getTemp !== void 0 ? _this$obj$getTemp : undefined;
342
+ }
343
+ /* -------------------------------------------------------------------------- */
330
344
  }, {
331
345
  key: "getIndexOrID",
332
346
  value: function getIndexOrID() {
@@ -350,33 +364,33 @@ var ObjectManager = /*#__PURE__*/function (_notifyChanged, _setValue, _setSubVal
350
364
  /* -------------------------------------------------------------------------- */
351
365
  }, {
352
366
  key: "event_run",
353
- value: function event_run(_x15) {
354
- return (_event_run = _event_run || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(eventName) {
367
+ value: function event_run(_x14) {
368
+ return (_event_run = _event_run || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(eventName) {
355
369
  var _len,
356
370
  params,
357
371
  _key,
358
- _args7 = arguments;
359
- return _regeneratorRuntime().wrap(function _callee7$(_context7) {
360
- while (1) switch (_context7.prev = _context7.next) {
372
+ _args6 = arguments;
373
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
374
+ while (1) switch (_context6.prev = _context6.next) {
361
375
  case 0:
362
376
  if (!(this.__stopEvents === true)) {
363
- _context7.next = 2;
377
+ _context6.next = 2;
364
378
  break;
365
379
  }
366
- return _context7.abrupt("return");
380
+ return _context6.abrupt("return");
367
381
  case 2:
368
- for (_len = _args7.length, params = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
369
- params[_key - 1] = _args7[_key];
382
+ for (_len = _args6.length, params = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
383
+ params[_key - 1] = _args6[_key];
370
384
  }
371
- _context7.next = 5;
385
+ _context6.next = 5;
372
386
  return _event.EventManager.run.apply(_event.EventManager, [this, eventName].concat(params));
373
387
  case 5:
374
- return _context7.abrupt("return", _context7.sent);
388
+ return _context6.abrupt("return", _context6.sent);
375
389
  case 6:
376
390
  case "end":
377
- return _context7.stop();
391
+ return _context6.stop();
378
392
  }
379
- }, _callee7, this);
393
+ }, _callee6, this);
380
394
  }))).apply(this, arguments);
381
395
  }
382
396
  }, {
@@ -406,23 +420,23 @@ var ObjectManager = /*#__PURE__*/function (_notifyChanged, _setValue, _setSubVal
406
420
  }
407
421
  }, {
408
422
  key: "event_add",
409
- value: function event_add(_x16, _x17, _x18) {
410
- return (_event_add = _event_add || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(name, uname, runEvent) {
423
+ value: function event_add(_x15, _x16, _x17) {
424
+ return (_event_add = _event_add || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(name, uname, runEvent) {
411
425
  var onlyOn,
412
426
  runOnce,
413
- _args8 = arguments;
414
- return _regeneratorRuntime().wrap(function _callee8$(_context8) {
415
- while (1) switch (_context8.prev = _context8.next) {
427
+ _args7 = arguments;
428
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
429
+ while (1) switch (_context7.prev = _context7.next) {
416
430
  case 0:
417
- onlyOn = _args8.length > 3 && _args8[3] !== undefined ? _args8[3] : null;
418
- runOnce = _args8.length > 4 && _args8[4] !== undefined ? _args8[4] : false;
419
- _context8.next = 4;
431
+ onlyOn = _args7.length > 3 && _args7[3] !== undefined ? _args7[3] : null;
432
+ runOnce = _args7.length > 4 && _args7[4] !== undefined ? _args7[4] : false;
433
+ _context7.next = 4;
420
434
  return _event.EventManager.add(this, name, uname, runEvent, onlyOn, runOnce);
421
435
  case 4:
422
436
  case "end":
423
- return _context8.stop();
437
+ return _context7.stop();
424
438
  }
425
- }, _callee8, this);
439
+ }, _callee7, this);
426
440
  }))).apply(this, arguments);
427
441
  }
428
442
  }, {
@@ -464,38 +478,38 @@ var ObjectManager = /*#__PURE__*/function (_notifyChanged, _setValue, _setSubVal
464
478
  * @param value
465
479
  * @returns
466
480
  */
467
- function toggleOption(_x19, _x20) {
468
- return (_toggleOption = _toggleOption || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(key, value) {
481
+ function toggleOption(_x18, _x19) {
482
+ return (_toggleOption = _toggleOption || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(key, value) {
469
483
  var oldval;
470
- return _regeneratorRuntime().wrap(function _callee9$(_context9) {
471
- while (1) switch (_context9.prev = _context9.next) {
484
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
485
+ while (1) switch (_context8.prev = _context8.next) {
472
486
  case 0:
473
487
  oldval = this.getOption(key);
474
488
  if (!(0, _object.object_equals_loose)(oldval, value)) {
475
- _context9.next = 6;
489
+ _context8.next = 6;
476
490
  break;
477
491
  }
478
- _context9.next = 4;
492
+ _context8.next = 4;
479
493
  return this.setOption(key, null);
480
494
  case 4:
481
- _context9.next = 8;
495
+ _context8.next = 8;
482
496
  break;
483
497
  case 6:
484
- _context9.next = 8;
498
+ _context8.next = 8;
485
499
  return this.setOption(key, value);
486
500
  case 8:
487
501
  case "end":
488
- return _context9.stop();
502
+ return _context8.stop();
489
503
  }
490
- }, _callee9, this);
504
+ }, _callee8, this);
491
505
  }))).apply(this, arguments);
492
506
  }
493
507
  }, {
494
508
  key: "setOption",
495
- value: function setOption(_x21, _x22) {
496
- return (_setOption = _setOption || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(key, value) {
497
- return _regeneratorRuntime().wrap(function _callee10$(_context10) {
498
- while (1) switch (_context10.prev = _context10.next) {
509
+ value: function setOption(_x20, _x21) {
510
+ return (_setOption = _setOption || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(key, value) {
511
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
512
+ while (1) switch (_context9.prev = _context9.next) {
499
513
  case 0:
500
514
  if (this.__options == null) this.__options = {};
501
515
  if (value == null) {
@@ -503,15 +517,15 @@ var ObjectManager = /*#__PURE__*/function (_notifyChanged, _setValue, _setSubVal
503
517
  } else {
504
518
  this.__options[key] = value;
505
519
  }
506
- _context10.next = 4;
520
+ _context9.next = 4;
507
521
  return this.event_run("on_option_change", key, value);
508
522
  case 4:
509
- return _context10.abrupt("return", _context10.sent);
523
+ return _context9.abrupt("return", _context9.sent);
510
524
  case 5:
511
525
  case "end":
512
- return _context10.stop();
526
+ return _context9.stop();
513
527
  }
514
- }, _callee10, this);
528
+ }, _callee9, this);
515
529
  }))).apply(this, arguments);
516
530
  }
517
531
  /**
@@ -537,28 +551,28 @@ var ObjectManager = /*#__PURE__*/function (_notifyChanged, _setValue, _setSubVal
537
551
  */
538
552
  }, {
539
553
  key: "holdOption",
540
- value: function holdOption(_x23, _x24, _x25, _x26) {
541
- return (_holdOption = _holdOption || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(key, value, nextvalue, action) {
542
- return _regeneratorRuntime().wrap(function _callee11$(_context11) {
543
- while (1) switch (_context11.prev = _context11.next) {
554
+ value: function holdOption(_x22, _x23, _x24, _x25) {
555
+ return (_holdOption = _holdOption || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(key, value, nextvalue, action) {
556
+ return _regeneratorRuntime().wrap(function _callee10$(_context10) {
557
+ while (1) switch (_context10.prev = _context10.next) {
544
558
  case 0:
545
- _context11.prev = 0;
559
+ _context10.prev = 0;
546
560
  this.setOption(key, value);
547
561
  if (!(typeof action === "function")) {
548
- _context11.next = 5;
562
+ _context10.next = 5;
549
563
  break;
550
564
  }
551
- _context11.next = 5;
565
+ _context10.next = 5;
552
566
  return action();
553
567
  case 5:
554
- _context11.prev = 5;
568
+ _context10.prev = 5;
555
569
  this.setOption(key, nextvalue);
556
- return _context11.finish(5);
570
+ return _context10.finish(5);
557
571
  case 8:
558
572
  case "end":
559
- return _context11.stop();
573
+ return _context10.stop();
560
574
  }
561
- }, _callee11, this, [[0,, 5, 8]]);
575
+ }, _callee10, this, [[0,, 5, 8]]);
562
576
  }))).apply(this, arguments);
563
577
  }
564
578
  }, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azrico/webobject",
3
- "version": "1.4.74",
3
+ "version": "1.4.77",
4
4
  "description": "Stateful object",
5
5
  "author": "Azrideus",
6
6
  "license": "MIT",