UNPKG

895 BJavaScriptView Raw
1// eslint-disable-next-line @typescript-eslint/no-explicit-any
2export function OnChange() {
3 const sufix = 'Change';
4 // eslint-disable-next-line @typescript-eslint/no-explicit-any
5 return function OnChangeHandler(target, propertyKey) {
6 const _key = ` __${propertyKey}Value`;
7 Object.defineProperty(target, propertyKey, {
8 // eslint-disable-next-line @typescript-eslint/no-explicit-any
9 get() {
10 return this[_key];
11 },
12 // eslint-disable-next-line @typescript-eslint/no-explicit-any
13 set(value) {
14 const prevValue = this[_key];
15 this[_key] = value;
16 if (prevValue !== value && this[propertyKey + sufix]) {
17 this[propertyKey + sufix].emit(value);
18 }
19 }
20 });
21 };
22}
23//# sourceMappingURL=decorators.js.map
\No newline at end of file