@azrico/webobject 1.4.151 → 1.4.153

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.
@@ -69,12 +69,11 @@ var ObjectManager = exports.ObjectManager = /*#__PURE__*/function (_RawObject) {
69
69
  case 3:
70
70
  if (value === undefined && type != "meta") value = obj.getValue(key);
71
71
  typestr = (type ? "$".concat(type, "$") : "") + String(key);
72
- console.log("event_run", typestr, value);
73
- _context.next = 8;
72
+ _context.next = 7;
74
73
  return this.event_run("on_change", typestr, value);
75
- case 8:
74
+ case 7:
76
75
  return _context.abrupt("return", _context.sent);
77
- case 9:
76
+ case 8:
78
77
  case "end":
79
78
  return _context.stop();
80
79
  }
@@ -114,9 +113,13 @@ var ObjectManager = exports.ObjectManager = /*#__PURE__*/function (_RawObject) {
114
113
  }, {
115
114
  key: "setObject",
116
115
  value: function setObject(toObj) {
116
+ var _this2 = this;
117
117
  this.__currentObject = toObj;
118
- if (this.__currentObject) {
119
- this.__currentObject.set_managerClass(this);
118
+ if (this.obj) {
119
+ this.obj.get_managerClass = function () {
120
+ return _this2;
121
+ };
122
+ // this.obj.set_managerClass(this);
120
123
  }
121
124
  if (toObj == null && !this.__object_nullable) {
122
125
  console.warn("setObject was used to set null. try to use empty objects instead of null");
@@ -636,9 +639,9 @@ var ObjectManager = exports.ObjectManager = /*#__PURE__*/function (_RawObject) {
636
639
  }, {
637
640
  key: "useOption",
638
641
  value: function useOption(key) {
639
- var _this2 = this;
642
+ var _this3 = this;
640
643
  return this.event_use_getter("on_option_change", function () {
641
- return _this2.getOption(key);
644
+ return _this3.getOption(key);
642
645
  }, [key]);
643
646
  }
644
647
  /**
@@ -200,7 +200,16 @@ export declare class SimpleObject extends MapableObject {
200
200
  get lastChanged(): string;
201
201
  get manager(): ObjectManager<any> | undefined;
202
202
  get_managerClass: () => ObjectManager<any> | undefined;
203
- set_managerClass(mng: any): void;
203
+ /**
204
+ * @deprecated use setManager
205
+ * @param mng
206
+ */
207
+ set_managerClass(mng: any): boolean | undefined;
208
+ /**
209
+ * update the manager class for this object
210
+ * @param mng
211
+ */
212
+ setManager(mng: any): boolean | undefined;
204
213
  static isDeleted<T extends SimpleObject>(obj: T): boolean;
205
214
  getIndexOrID(): number | string;
206
215
  getIndex(): number;
@@ -616,17 +616,16 @@ var SimpleObject = exports.SimpleObject = /*#__PURE__*/function (_MapableObject)
616
616
  /* --------------------------- notify the manager --------------------------- */
617
617
  manager_class = this.manager;
618
618
  if (!(typeof (manager_class === null || manager_class === void 0 ? void 0 : manager_class.notifyChanged) === "function")) {
619
- _context11.next = 12;
619
+ _context11.next = 11;
620
620
  break;
621
621
  }
622
- console.log("notify manager", type, key, value);
623
- _context11.next = 11;
622
+ _context11.next = 10;
624
623
  return manager_class.notifyChanged(type, key, value, subvalue);
625
- case 11:
624
+ case 10:
626
625
  return _context11.abrupt("return", _context11.sent);
627
- case 12:
626
+ case 11:
628
627
  return _context11.abrupt("return", false);
629
- case 13:
628
+ case 12:
630
629
  case "end":
631
630
  return _context11.stop();
632
631
  }
@@ -927,10 +926,25 @@ var SimpleObject = exports.SimpleObject = /*#__PURE__*/function (_MapableObject)
927
926
  }
928
927
  }, {
929
928
  key: "set_managerClass",
930
- value: function set_managerClass(mng) {
931
- if (mng instanceof _ObjectManager["default"] && typeof mng.event_run === "function") this.get_managerClass = function () {
932
- return mng;
933
- };else {
929
+ value:
930
+ /**
931
+ * @deprecated use setManager
932
+ * @param mng
933
+ */
934
+ function set_managerClass(mng) {
935
+ return this.setManager(mng);
936
+ }
937
+ /**
938
+ * update the manager class for this object
939
+ * @param mng
940
+ */
941
+ }, {
942
+ key: "setManager",
943
+ value: function setManager(mng) {
944
+ if (mng instanceof _ObjectManager["default"] && typeof mng.setObject === "function") {
945
+ //make sure the manager knows what object it is managing
946
+ return mng.setObject(this);
947
+ } else {
934
948
  console.error("set_managerClass was used with a bad manager. make sure the input to this function is a correct ObjectManager");
935
949
  }
936
950
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azrico/webobject",
3
- "version": "1.4.151",
3
+ "version": "1.4.153",
4
4
  "description": "Stateful object",
5
5
  "author": "Azrideus",
6
6
  "license": "MIT",