@azrico/webobject 1.5.58 → 1.5.61
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.
- package/README.md +9 -9
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/src/WebObjects/ParentWebObject.d.ts +24 -0
- package/dist/src/WebObjects/ParentWebObject.js +77 -0
- package/dist/src/WebObjects/WebObject.d.ts +153 -0
- package/dist/src/WebObjects/WebObject.js +654 -0
- package/dist/src/WebObjects/WebObjectHelper.d.ts +9 -0
- package/dist/src/WebObjects/WebObjectHelper.js +18 -0
- package/dist/src/WebObjects/WebObjectHelper.test.d.ts +1 -0
- package/dist/src/WebObjects/WebObjectHelper.test.js +45 -0
- package/dist/src/WebObjects/WebObjectManager.d.ts +68 -0
- package/dist/src/WebObjects/WebObjectManager.js +290 -0
- package/dist/src/WebObjects/WebObjectPathHelper.d.ts +36 -0
- package/dist/src/WebObjects/WebObjectPathHelper.js +84 -0
- package/dist/src/WebObjects/WebObjectPathHelper.test.d.ts +1 -0
- package/dist/src/WebObjects/WebObjectPathHelper.test.js +31 -0
- package/dist/src/index.d.ts +10 -0
- package/dist/src/index.js +10 -0
- package/dist/src/structs/DummyObject.d.ts +5 -0
- package/dist/src/structs/DummyObject.js +8 -0
- package/dist/src/structs/MapableObject.d.ts +43 -0
- package/dist/src/structs/MapableObject.js +77 -0
- package/dist/src/structs/MetaObject.d.ts +15 -0
- package/dist/src/structs/MetaObject.js +35 -0
- package/dist/src/structs/ObjectArray.d.ts +10 -0
- package/dist/src/structs/ObjectArray.js +43 -0
- package/dist/src/structs/ObjectManager.d.ts +136 -0
- package/dist/src/structs/ObjectManager.js +332 -0
- package/dist/src/structs/ObjectWithTemp.d.ts +16 -0
- package/dist/src/structs/ObjectWithTemp.js +35 -0
- package/dist/src/structs/SimpleObject.js +1138 -0
- package/package.json +1 -1
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { object_get, object_set } from "@azrico/object";
|
|
2
|
+
/**
|
|
3
|
+
* This object supports temp values
|
|
4
|
+
*/
|
|
5
|
+
export class ObjectWithTemp {
|
|
6
|
+
__temp = undefined;
|
|
7
|
+
constructor() { }
|
|
8
|
+
/* ---------------------------------- temp ---------------------------------- */
|
|
9
|
+
#getTempProperty(key) {
|
|
10
|
+
if (this.__temp == null)
|
|
11
|
+
return undefined;
|
|
12
|
+
return object_get(this.__temp, key);
|
|
13
|
+
}
|
|
14
|
+
#setTempProperty(key, value) {
|
|
15
|
+
if (this.__temp == null)
|
|
16
|
+
this.__temp = {};
|
|
17
|
+
return object_set(this.__temp, key, value);
|
|
18
|
+
}
|
|
19
|
+
getTemp = this.#getTempProperty;
|
|
20
|
+
async setTemp(key, value) {
|
|
21
|
+
let isValueChanged = false;
|
|
22
|
+
isValueChanged = this.#getTempProperty(key) != value;
|
|
23
|
+
this.#setTempProperty(key, value);
|
|
24
|
+
return isValueChanged;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* clear and discard all temp values
|
|
28
|
+
* @returns
|
|
29
|
+
*/
|
|
30
|
+
clear_cache() {
|
|
31
|
+
delete this.__temp;
|
|
32
|
+
return true;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
export default ObjectWithTemp;
|