@azrico/webobject 1.2.17 → 1.2.19

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.
@@ -41,6 +41,8 @@ export declare class SimpleObject extends MapableObject {
41
41
  */
42
42
  setValue(key: WriteablePropOf<this>, value: any, sendChanges?: sendChangesType): Promise<boolean>;
43
43
  set: (key: WriteablePropOf<this>, value: any, sendChanges?: sendChangesType) => Promise<boolean>;
44
+ setDefaultValue(key: WriteablePropOf<this>, value: any): boolean;
45
+ setDefault: (key: WriteablePropOf<this>, value: any) => boolean;
44
46
  /**
45
47
  * set key of subObject
46
48
  * @param key
@@ -63,6 +63,8 @@ var _getSubProperty = /*#__PURE__*/new WeakSet();
63
63
 
64
64
  var _setProperty = /*#__PURE__*/new WeakSet();
65
65
 
66
+ var _setDefaultProperty = /*#__PURE__*/new WeakSet();
67
+
66
68
  var _getProperty = /*#__PURE__*/new WeakSet();
67
69
 
68
70
  var _setSaveResultObject = /*#__PURE__*/new WeakSet();
@@ -85,6 +87,8 @@ var SimpleObject = /*#__PURE__*/function (_MapableObject) {
85
87
 
86
88
  _classPrivateMethodInitSpec(_assertThisInitialized(_this), _getProperty);
87
89
 
90
+ _classPrivateMethodInitSpec(_assertThisInitialized(_this), _setDefaultProperty);
91
+
88
92
  _classPrivateMethodInitSpec(_assertThisInitialized(_this), _setProperty);
89
93
 
90
94
  _classPrivateMethodInitSpec(_assertThisInitialized(_this), _getSubProperty);
@@ -123,6 +127,8 @@ var SimpleObject = /*#__PURE__*/function (_MapableObject) {
123
127
 
124
128
  _defineProperty(_assertThisInitialized(_this), "set", _this.setValue);
125
129
 
130
+ _defineProperty(_assertThisInitialized(_this), "setDefault", _this.setDefaultValue);
131
+
126
132
  _defineProperty(_assertThisInitialized(_this), "get_managerClass", function () {
127
133
  return null;
128
134
  });
@@ -234,6 +240,11 @@ var SimpleObject = /*#__PURE__*/function (_MapableObject) {
234
240
 
235
241
  return setValue;
236
242
  }()
243
+ }, {
244
+ key: "setDefaultValue",
245
+ value: function setDefaultValue(key, value) {
246
+ return _classPrivateMethodGet(this, _setDefaultProperty, _setDefaultProperty2).call(this, key, value);
247
+ }
237
248
  }, {
238
249
  key: "setSubValue",
239
250
  value:
@@ -977,6 +988,16 @@ function _setProperty2(key, value) {
977
988
  return true;
978
989
  }
979
990
 
991
+ function _setDefaultProperty2(key, value) {
992
+ //@ts-ignore
993
+ if (this[key] == undefined || this[key] === "" || this[key] === 0) {
994
+ this[key] = value;
995
+ return true;
996
+ }
997
+
998
+ return false;
999
+ }
1000
+
980
1001
  function _getProperty2(key) {
981
1002
  var original = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
982
1003
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azrico/webobject",
3
- "version": "1.2.17",
3
+ "version": "1.2.19",
4
4
  "description": "Stateful object",
5
5
  "author": "Azrideus",
6
6
  "license": "MIT",