@azrico/webobject 1.3.19 → 1.3.20
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.
|
@@ -147,6 +147,10 @@ export declare class SimpleObject extends MapableObject {
|
|
|
147
147
|
static getIndexOrID(o: any): number;
|
|
148
148
|
static getIndex(o: any): number;
|
|
149
149
|
static getID(o: any): string;
|
|
150
|
+
event_run(eventName: string, ...params: any): Promise<any[] | undefined>;
|
|
151
|
+
event_use(name: string, runEvent: (...inputdata: any) => any, onlyOn?: any, runOnce?: boolean): any;
|
|
152
|
+
event_remove(name: string, uname: string): boolean | undefined;
|
|
153
|
+
event_add(name: string, uname: string, runEvent: (...inputdata: any) => any, onlyOn?: any, runOnce?: boolean): Promise<void>;
|
|
150
154
|
getOriginal(): this | undefined;
|
|
151
155
|
setOriginal(toObj?: null | 0 | any): this | undefined;
|
|
152
156
|
static setOriginal<T>(obj: T, toObj?: null | 0 | any): T | undefined;
|
|
@@ -657,11 +657,107 @@ var SimpleObject = /*#__PURE__*/function (_MapableObject) {
|
|
|
657
657
|
return SimpleObject.getID(this);
|
|
658
658
|
}
|
|
659
659
|
}, {
|
|
660
|
-
key: "
|
|
661
|
-
value:
|
|
660
|
+
key: "event_run",
|
|
661
|
+
value:
|
|
662
|
+
/* -------------------------------------------------------------------------- */
|
|
663
|
+
/* Events */
|
|
664
|
+
/* -------------------------------------------------------------------------- */
|
|
665
|
+
/* -------------------------------------------------------------------------- */
|
|
666
|
+
/* Events */
|
|
667
|
+
/* -------------------------------------------------------------------------- */
|
|
668
|
+
function () {
|
|
669
|
+
var _event_run = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(eventName) {
|
|
670
|
+
var _this$manager;
|
|
671
|
+
var _len,
|
|
672
|
+
params,
|
|
673
|
+
_key,
|
|
674
|
+
_args7 = arguments;
|
|
675
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
676
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
677
|
+
case 0:
|
|
678
|
+
if (this.manager) {
|
|
679
|
+
_context7.next = 3;
|
|
680
|
+
break;
|
|
681
|
+
}
|
|
682
|
+
console.error("you cant use events if your object has no manager");
|
|
683
|
+
return _context7.abrupt("return");
|
|
684
|
+
case 3:
|
|
685
|
+
for (_len = _args7.length, params = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
686
|
+
params[_key - 1] = _args7[_key];
|
|
687
|
+
}
|
|
688
|
+
_context7.next = 6;
|
|
689
|
+
return (_this$manager = this.manager).event_run.apply(_this$manager, [eventName].concat(params));
|
|
690
|
+
case 6:
|
|
691
|
+
return _context7.abrupt("return", _context7.sent);
|
|
692
|
+
case 7:
|
|
693
|
+
case "end":
|
|
694
|
+
return _context7.stop();
|
|
695
|
+
}
|
|
696
|
+
}, _callee7, this);
|
|
697
|
+
}));
|
|
698
|
+
function event_run(_x13) {
|
|
699
|
+
return _event_run.apply(this, arguments);
|
|
700
|
+
}
|
|
701
|
+
return event_run;
|
|
702
|
+
}()
|
|
703
|
+
}, {
|
|
704
|
+
key: "event_use",
|
|
705
|
+
value: function event_use(name, runEvent) {
|
|
706
|
+
var onlyOn = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
707
|
+
var runOnce = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
708
|
+
if (!this.manager) {
|
|
709
|
+
console.error("you cant use events if your object has no manager");
|
|
710
|
+
return;
|
|
711
|
+
}
|
|
712
|
+
return this.manager.event_use(name, runEvent, onlyOn, runOnce);
|
|
713
|
+
}
|
|
714
|
+
}, {
|
|
715
|
+
key: "event_remove",
|
|
716
|
+
value: function event_remove(name, uname) {
|
|
717
|
+
if (!this.manager) {
|
|
718
|
+
console.error("you cant use events if your object has no manager");
|
|
719
|
+
return;
|
|
720
|
+
}
|
|
721
|
+
return this.manager.event_remove(name, uname);
|
|
722
|
+
}
|
|
723
|
+
}, {
|
|
724
|
+
key: "event_add",
|
|
725
|
+
value: function () {
|
|
726
|
+
var _event_add = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(name, uname, runEvent) {
|
|
727
|
+
var onlyOn,
|
|
728
|
+
runOnce,
|
|
729
|
+
_args8 = arguments;
|
|
730
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
731
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
732
|
+
case 0:
|
|
733
|
+
onlyOn = _args8.length > 3 && _args8[3] !== undefined ? _args8[3] : null;
|
|
734
|
+
runOnce = _args8.length > 4 && _args8[4] !== undefined ? _args8[4] : false;
|
|
735
|
+
if (this.manager) {
|
|
736
|
+
_context8.next = 5;
|
|
737
|
+
break;
|
|
738
|
+
}
|
|
739
|
+
console.error("you cant use events if your object has no manager");
|
|
740
|
+
return _context8.abrupt("return");
|
|
741
|
+
case 5:
|
|
742
|
+
_context8.next = 7;
|
|
743
|
+
return this.manager.event_add(name, uname, runEvent, onlyOn, runOnce);
|
|
744
|
+
case 7:
|
|
745
|
+
case "end":
|
|
746
|
+
return _context8.stop();
|
|
747
|
+
}
|
|
748
|
+
}, _callee8, this);
|
|
749
|
+
}));
|
|
750
|
+
function event_add(_x14, _x15, _x16) {
|
|
751
|
+
return _event_add.apply(this, arguments);
|
|
752
|
+
}
|
|
753
|
+
return event_add;
|
|
754
|
+
}()
|
|
755
|
+
/* -------------------------------------------------------------------------- */
|
|
662
756
|
/* Original */
|
|
663
757
|
/* -------------------------------------------------------------------------- */
|
|
664
|
-
|
|
758
|
+
}, {
|
|
759
|
+
key: "getOriginal",
|
|
760
|
+
value: function getOriginal() {
|
|
665
761
|
return this.__originalobject || undefined;
|
|
666
762
|
}
|
|
667
763
|
}, {
|
|
@@ -733,10 +829,10 @@ var SimpleObject = /*#__PURE__*/function (_MapableObject) {
|
|
|
733
829
|
delete obj[key];
|
|
734
830
|
}
|
|
735
831
|
} else if (_typeof(initObject) == "object") {
|
|
736
|
-
for (var
|
|
737
|
-
if (
|
|
738
|
-
if (fullUpdate || Object.prototype.hasOwnProperty.call(obj,
|
|
739
|
-
obj[
|
|
832
|
+
for (var _key2 in initObject) {
|
|
833
|
+
if (_key2.startsWith("__")) continue;
|
|
834
|
+
if (fullUpdate || Object.prototype.hasOwnProperty.call(obj, _key2)) {
|
|
835
|
+
obj[_key2] = initObject[_key2];
|
|
740
836
|
}
|
|
741
837
|
}
|
|
742
838
|
}
|