@azrico/webobject 1.4.42 → 1.4.43

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.
@@ -53,6 +53,7 @@ export declare class ObjectManager<ObjType extends SimpleObject> {
53
53
  */
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
+ setTemp(key: string, value: any): Promise<any>;
56
57
  getIndexOrID(): number | string;
57
58
  getIndex(): number;
58
59
  getID(): string;
@@ -71,6 +72,8 @@ export declare class ObjectManager<ObjType extends SimpleObject> {
71
72
  events_start(): void;
72
73
  events_stop(): void;
73
74
  events_clear(): void;
75
+ clear_changes(): boolean | undefined;
76
+ clear_cache(): boolean | undefined;
74
77
  static events_clear(obj: ObjectManager<any>): void;
75
78
  /**
76
79
  * Set an option to some value, if its already equal to the value it will be deleted instead
@@ -287,24 +287,54 @@ var ObjectManager = /*#__PURE__*/function () {
287
287
  return _pushValue.apply(this, arguments);
288
288
  }
289
289
  return pushValue;
290
+ }() //set temp value
291
+ }, {
292
+ key: "setTemp",
293
+ value: function () {
294
+ var _setTemp = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(key, value) {
295
+ var _this$obj8;
296
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
297
+ while (1) switch (_context5.prev = _context5.next) {
298
+ case 0:
299
+ _context5.next = 2;
300
+ return (_this$obj8 = this.obj) === null || _this$obj8 === void 0 ? void 0 : _this$obj8.setTemp(key, value);
301
+ case 2:
302
+ _context5.t0 = _context5.sent;
303
+ if (_context5.t0) {
304
+ _context5.next = 5;
305
+ break;
306
+ }
307
+ _context5.t0 = false;
308
+ case 5:
309
+ return _context5.abrupt("return", _context5.t0);
310
+ case 6:
311
+ case "end":
312
+ return _context5.stop();
313
+ }
314
+ }, _callee5, this);
315
+ }));
316
+ function setTemp(_x12, _x13) {
317
+ return _setTemp.apply(this, arguments);
318
+ }
319
+ return setTemp;
290
320
  }() /* -------------------------------------------------------------------------- */
291
321
  }, {
292
322
  key: "getIndexOrID",
293
323
  value: function getIndexOrID() {
294
- var _this$obj8;
295
- return ((_this$obj8 = this.obj) === null || _this$obj8 === void 0 ? void 0 : _this$obj8.getIndexOrID()) || -1;
324
+ var _this$obj9;
325
+ return ((_this$obj9 = this.obj) === null || _this$obj9 === void 0 ? void 0 : _this$obj9.getIndexOrID()) || -1;
296
326
  }
297
327
  }, {
298
328
  key: "getIndex",
299
329
  value: function getIndex() {
300
- var _this$obj9;
301
- return ((_this$obj9 = this.obj) === null || _this$obj9 === void 0 ? void 0 : _this$obj9.getIndex()) || -1;
330
+ var _this$obj10;
331
+ return ((_this$obj10 = this.obj) === null || _this$obj10 === void 0 ? void 0 : _this$obj10.getIndex()) || -1;
302
332
  }
303
333
  }, {
304
334
  key: "getID",
305
335
  value: function getID() {
306
- var _this$obj10;
307
- return ((_this$obj10 = this.obj) === null || _this$obj10 === void 0 ? void 0 : _this$obj10.getID()) || "";
336
+ var _this$obj11;
337
+ return ((_this$obj11 = this.obj) === null || _this$obj11 === void 0 ? void 0 : _this$obj11.getID()) || "";
308
338
  }
309
339
  /* -------------------------------------------------------------------------- */
310
340
  /* Events */
@@ -312,34 +342,34 @@ var ObjectManager = /*#__PURE__*/function () {
312
342
  }, {
313
343
  key: "event_run",
314
344
  value: function () {
315
- var _event_run = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(eventName) {
345
+ var _event_run = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(eventName) {
316
346
  var _len,
317
347
  params,
318
348
  _key,
319
- _args5 = arguments;
320
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
321
- while (1) switch (_context5.prev = _context5.next) {
349
+ _args6 = arguments;
350
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
351
+ while (1) switch (_context6.prev = _context6.next) {
322
352
  case 0:
323
353
  if (!(this.__stopEvents === true)) {
324
- _context5.next = 2;
354
+ _context6.next = 2;
325
355
  break;
326
356
  }
327
- return _context5.abrupt("return");
357
+ return _context6.abrupt("return");
328
358
  case 2:
329
- for (_len = _args5.length, params = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
330
- params[_key - 1] = _args5[_key];
359
+ for (_len = _args6.length, params = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
360
+ params[_key - 1] = _args6[_key];
331
361
  }
332
- _context5.next = 5;
362
+ _context6.next = 5;
333
363
  return _event.EventManager.run.apply(_event.EventManager, [this, eventName].concat(params));
334
364
  case 5:
335
- return _context5.abrupt("return", _context5.sent);
365
+ return _context6.abrupt("return", _context6.sent);
336
366
  case 6:
337
367
  case "end":
338
- return _context5.stop();
368
+ return _context6.stop();
339
369
  }
340
- }, _callee5, this);
370
+ }, _callee6, this);
341
371
  }));
342
- function event_run(_x12) {
372
+ function event_run(_x14) {
343
373
  return _event_run.apply(this, arguments);
344
374
  }
345
375
  return event_run;
@@ -372,24 +402,24 @@ var ObjectManager = /*#__PURE__*/function () {
372
402
  }, {
373
403
  key: "event_add",
374
404
  value: function () {
375
- var _event_add = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(name, uname, runEvent) {
405
+ var _event_add = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(name, uname, runEvent) {
376
406
  var onlyOn,
377
407
  runOnce,
378
- _args6 = arguments;
379
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
380
- while (1) switch (_context6.prev = _context6.next) {
408
+ _args7 = arguments;
409
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
410
+ while (1) switch (_context7.prev = _context7.next) {
381
411
  case 0:
382
- onlyOn = _args6.length > 3 && _args6[3] !== undefined ? _args6[3] : null;
383
- runOnce = _args6.length > 4 && _args6[4] !== undefined ? _args6[4] : false;
384
- _context6.next = 4;
412
+ onlyOn = _args7.length > 3 && _args7[3] !== undefined ? _args7[3] : null;
413
+ runOnce = _args7.length > 4 && _args7[4] !== undefined ? _args7[4] : false;
414
+ _context7.next = 4;
385
415
  return _event.EventManager.add(this, name, uname, runEvent, onlyOn, runOnce);
386
416
  case 4:
387
417
  case "end":
388
- return _context6.stop();
418
+ return _context7.stop();
389
419
  }
390
- }, _callee6, this);
420
+ }, _callee7, this);
391
421
  }));
392
- function event_add(_x13, _x14, _x15) {
422
+ function event_add(_x15, _x16, _x17) {
393
423
  return _event_add.apply(this, arguments);
394
424
  }
395
425
  return event_add;
@@ -409,6 +439,18 @@ var ObjectManager = /*#__PURE__*/function () {
409
439
  value: function events_clear() {
410
440
  ObjectManager.events_clear(this);
411
441
  }
442
+ }, {
443
+ key: "clear_changes",
444
+ value: function clear_changes() {
445
+ var _this$obj12;
446
+ return (_this$obj12 = this.obj) === null || _this$obj12 === void 0 ? void 0 : _this$obj12.clear_changes();
447
+ }
448
+ }, {
449
+ key: "clear_cache",
450
+ value: function clear_cache() {
451
+ var _this$obj13;
452
+ return (_this$obj13 = this.obj) === null || _this$obj13 === void 0 ? void 0 : _this$obj13.clear_cache();
453
+ }
412
454
  }, {
413
455
  key: "toggleOption",
414
456
  value:
@@ -422,31 +464,31 @@ var ObjectManager = /*#__PURE__*/function () {
422
464
  * @returns
423
465
  */
424
466
  function () {
425
- var _toggleOption = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(key, value) {
467
+ var _toggleOption = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(key, value) {
426
468
  var oldval;
427
- return _regeneratorRuntime().wrap(function _callee7$(_context7) {
428
- while (1) switch (_context7.prev = _context7.next) {
469
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
470
+ while (1) switch (_context8.prev = _context8.next) {
429
471
  case 0:
430
472
  oldval = this.getOption(key);
431
473
  if (!(0, _object.object_equals_loose)(oldval, value)) {
432
- _context7.next = 6;
474
+ _context8.next = 6;
433
475
  break;
434
476
  }
435
- _context7.next = 4;
477
+ _context8.next = 4;
436
478
  return this.setOption(key, null);
437
479
  case 4:
438
- _context7.next = 8;
480
+ _context8.next = 8;
439
481
  break;
440
482
  case 6:
441
- _context7.next = 8;
483
+ _context8.next = 8;
442
484
  return this.setOption(key, value);
443
485
  case 8:
444
486
  case "end":
445
- return _context7.stop();
487
+ return _context8.stop();
446
488
  }
447
- }, _callee7, this);
489
+ }, _callee8, this);
448
490
  }));
449
- function toggleOption(_x16, _x17) {
491
+ function toggleOption(_x18, _x19) {
450
492
  return _toggleOption.apply(this, arguments);
451
493
  }
452
494
  return toggleOption;
@@ -454,9 +496,9 @@ var ObjectManager = /*#__PURE__*/function () {
454
496
  }, {
455
497
  key: "setOption",
456
498
  value: function () {
457
- var _setOption = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(key, value) {
458
- return _regeneratorRuntime().wrap(function _callee8$(_context8) {
459
- while (1) switch (_context8.prev = _context8.next) {
499
+ var _setOption = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(key, value) {
500
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
501
+ while (1) switch (_context9.prev = _context9.next) {
460
502
  case 0:
461
503
  if (this.__options == null) this.__options = {};
462
504
  if (value == null) {
@@ -464,17 +506,17 @@ var ObjectManager = /*#__PURE__*/function () {
464
506
  } else {
465
507
  this.__options[key] = value;
466
508
  }
467
- _context8.next = 4;
509
+ _context9.next = 4;
468
510
  return this.event_run("on_option_change", key, value);
469
511
  case 4:
470
- return _context8.abrupt("return", _context8.sent);
512
+ return _context9.abrupt("return", _context9.sent);
471
513
  case 5:
472
514
  case "end":
473
- return _context8.stop();
515
+ return _context9.stop();
474
516
  }
475
- }, _callee8, this);
517
+ }, _callee9, this);
476
518
  }));
477
- function setOption(_x18, _x19) {
519
+ function setOption(_x20, _x21) {
478
520
  return _setOption.apply(this, arguments);
479
521
  }
480
522
  return setOption;
@@ -503,29 +545,29 @@ var ObjectManager = /*#__PURE__*/function () {
503
545
  }, {
504
546
  key: "holdOption",
505
547
  value: function () {
506
- var _holdOption = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(key, value, nextvalue, action) {
507
- return _regeneratorRuntime().wrap(function _callee9$(_context9) {
508
- while (1) switch (_context9.prev = _context9.next) {
548
+ var _holdOption = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(key, value, nextvalue, action) {
549
+ return _regeneratorRuntime().wrap(function _callee10$(_context10) {
550
+ while (1) switch (_context10.prev = _context10.next) {
509
551
  case 0:
510
- _context9.prev = 0;
552
+ _context10.prev = 0;
511
553
  this.setOption(key, value);
512
554
  if (!(typeof action === "function")) {
513
- _context9.next = 5;
555
+ _context10.next = 5;
514
556
  break;
515
557
  }
516
- _context9.next = 5;
558
+ _context10.next = 5;
517
559
  return action();
518
560
  case 5:
519
- _context9.prev = 5;
561
+ _context10.prev = 5;
520
562
  this.setOption(key, nextvalue);
521
- return _context9.finish(5);
563
+ return _context10.finish(5);
522
564
  case 8:
523
565
  case "end":
524
- return _context9.stop();
566
+ return _context10.stop();
525
567
  }
526
- }, _callee9, this, [[0,, 5, 8]]);
568
+ }, _callee10, this, [[0,, 5, 8]]);
527
569
  }));
528
- function holdOption(_x20, _x21, _x22, _x23) {
570
+ function holdOption(_x22, _x23, _x24, _x25) {
529
571
  return _holdOption.apply(this, arguments);
530
572
  }
531
573
  return holdOption;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azrico/webobject",
3
- "version": "1.4.42",
3
+ "version": "1.4.43",
4
4
  "description": "Stateful object",
5
5
  "author": "Azrideus",
6
6
  "license": "MIT",