ngx-bootstrap
Version:
Angular Bootstrap
23 lines • 895 B
JavaScript
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export function OnChange() {
const sufix = 'Change';
// eslint-disable-next-line @typescript-eslint/no-explicit-any
return function OnChangeHandler(target, propertyKey) {
const _key = ` __${propertyKey}Value`;
Object.defineProperty(target, propertyKey, {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
get() {
return this[_key];
},
// eslint-disable-next-line @typescript-eslint/no-explicit-any
set(value) {
const prevValue = this[_key];
this[_key] = value;
if (prevValue !== value && this[propertyKey + sufix]) {
this[propertyKey + sufix].emit(value);
}
}
});
};
}
//# sourceMappingURL=decorators.js.map