@azrico/webobject 1.5.61 → 1.5.62

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.
@@ -48,7 +48,11 @@ export declare class ObjectManager<ObjType extends SimpleObject> extends RawObje
48
48
  setSaveResult(toObj: any, type: saveResultType): saveResultType | undefined;
49
49
  apply_changes(): boolean;
50
50
  get(key: PropOf<ObjType>, original?: boolean): import("@azrico/types").PropType<ObjType, any> | null;
51
- useProperty(key: PropOf<ObjType>): Pick<this, any>;
51
+ /**
52
+ * use a property from the object, this will return latest value of the property
53
+ * uses `EventManager` to detect changes
54
+ */
55
+ use(key: PropOf<ObjType>): Pick<this, any>;
52
56
  /**
53
57
  * set value
54
58
  * @param key
@@ -109,7 +109,11 @@ export class ObjectManager extends RawObject {
109
109
  }
110
110
  return thisobj.get(key, original);
111
111
  }
112
- useProperty(key) {
112
+ /**
113
+ * use a property from the object, this will return latest value of the property
114
+ * uses `EventManager` to detect changes
115
+ */
116
+ use(key) {
113
117
  return EventManager.useProperty(this, key);
114
118
  }
115
119
  /**
@@ -3,7 +3,6 @@ import { combine_if_not_blank, string_isEmpty, string_to_color, } from "@azrico/
3
3
  import { gcache, gfunc } from "@azrico/global";
4
4
  import { MapableObject } from "./MapableObject";
5
5
  import ObjectManager from "./ObjectManager";
6
- import EventManager from "@azrico/event";
7
6
  export class SimpleObject extends MapableObject {
8
7
  static __db_name = "";
9
8
  static __object_name = "";
@@ -120,12 +119,18 @@ export class SimpleObject extends MapableObject {
120
119
  }
121
120
  return obj[key];
122
121
  }
123
- useProperty(key) {
122
+ /**
123
+ * use a property from the object, this will return latest value of the property
124
+ * uses `EventManager` to detect changes
125
+ *
126
+ * Only objects with a manager can use this function
127
+ */
128
+ use(key) {
124
129
  if (this.manager == null) {
125
130
  console.warn("Objects with no manager should not use useProperty");
126
131
  return this.get(key);
127
132
  }
128
- return EventManager.useProperty(this.manager, key);
133
+ return this.manager.use(key);
129
134
  }
130
135
  #getSubProperty(key, subkey, original = false) {
131
136
  let subobj = this.get(key, original);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azrico/webobject",
3
- "version": "1.5.61",
3
+ "version": "1.5.62",
4
4
  "description": "Stateful object",
5
5
  "author": "Azrideus",
6
6
  "license": "MIT",