light-h5-core-lib 2.10.3 → 2.10.5

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.
@@ -7,8 +7,13 @@ exports.SetterGetterBase = void 0;
7
7
  */
8
8
  var SetterGetterBase = /** @class */ (function () {
9
9
  function SetterGetterBase() {
10
- this.installAccessors();
11
10
  }
11
+ SetterGetterBase.prototype.isNeedCheckChanged = function (publicName) {
12
+ if (!this.ignoreCheckChangedFields || this.ignoreCheckChangedFields.length == 0) {
13
+ return true;
14
+ }
15
+ return !this.ignoreCheckChangedFields.includes(publicName);
16
+ };
12
17
  /**
13
18
  * 扫描实例属性并自动创建访问器
14
19
  */
@@ -65,8 +70,9 @@ var SetterGetterBase = /** @class */ (function () {
65
70
  if (oldValue === value)
66
71
  return;
67
72
  this[privateName] = value;
68
- // 可选:触发变更通知
69
- (_a = this.onPropertyChanged) === null || _a === void 0 ? void 0 : _a.call(this, publicName, value, oldValue);
73
+ if (this.isNeedCheckChanged(publicName)) {
74
+ (_a = this.onPropertyChanged) === null || _a === void 0 ? void 0 : _a.call(this, publicName, value, oldValue);
75
+ }
70
76
  },
71
77
  enumerable: true,
72
78
  configurable: true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "light-h5-core-lib",
3
- "version": "2.10.3",
3
+ "version": "2.10.5",
4
4
  "description": "light core lib",
5
5
  "main": "./LightCore.js",
6
6
  "types": "./type/index.d.ts",
package/type/index.d.ts CHANGED
@@ -479,16 +479,21 @@ export declare class ClassNameUtil {
479
479
  */
480
480
  static getClassName(obj: object): string;
481
481
  }
482
- export declare abstract class SetterGetterBase<T extends Record<string, any>> {
482
+ export declare abstract class SetterGetterBase {
483
483
  constructor();
484
484
  /**
485
485
  * 不需要添加setter / getter的字段(不需要加_前缀)
486
486
  */
487
487
  protected abstract get ignoreFields(): string[];
488
+ /**
489
+ * 不需要监听变化的字段(不需要加_前缀)
490
+ */
491
+ protected abstract get ignoreCheckChangedFields(): string[];
492
+ private isNeedCheckChanged;
488
493
  /**
489
494
  * 扫描实例属性并自动创建访问器
490
495
  */
491
- private installAccessors;
496
+ installAccessors(): void;
492
497
  /**
493
498
  * 安全获取对象的可枚举属性(排除方法)
494
499
  */