Archived
Template
1
Fork 0
This repository has been archived on 2024-09-04. You can view files and clone it, but cannot push or open issues or pull requests.
Contour/public/@shoelace-style/shoelace/cdn/chunks/chunk.FA5RT4K4.js

34 lines
911 B
JavaScript
Raw Normal View History

2024-01-30 10:59:28 -05:00
import {
__spreadValues
} from "./chunk.KIILAQWQ.js";
// src/internal/watch.ts
function watch(propertyName, options) {
const resolvedOptions = __spreadValues({
waitUntilFirstUpdate: false
}, options);
return (proto, decoratedFnName) => {
const { update } = proto;
const watchedProperties = Array.isArray(propertyName) ? propertyName : [propertyName];
proto.update = function(changedProps) {
watchedProperties.forEach((property) => {
const key = property;
if (changedProps.has(key)) {
const oldValue = changedProps.get(key);
const newValue = this[key];
if (oldValue !== newValue) {
if (!resolvedOptions.waitUntilFirstUpdate || this.hasUpdated) {
this[decoratedFnName](oldValue, newValue);
}
}
}
});
update.call(this, changedProps);
};
};
}
export {
watch
};