igniteui-webcomponents
Version:
Ignite UI for Web Components is a complete library of UI components, giving you the ability to build modern web applications using encapsulation and the concept of reusable components in a dependency-free approach.
19 lines • 792 B
JavaScript
export function watch(propName, options) {
return (protoOrDescriptor, name) => {
const { willUpdate } = protoOrDescriptor;
const watchOptions = Object.assign({ waitUntilFirstUpdate: false }, options);
protoOrDescriptor.willUpdate = function (changedProps) {
willUpdate.call(this, changedProps);
if (changedProps.has(propName)) {
const oldValue = changedProps.get(propName);
const newValue = this[propName];
if (oldValue !== newValue) {
if (!watchOptions?.waitUntilFirstUpdate || this.hasUpdated) {
this[name].call(this, oldValue, newValue);
}
}
}
};
};
}
//# sourceMappingURL=watch.js.map