-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
Description
E.g. currently Props adds side effects to attributeChangedCallback() and has to wrap it manually:
let _attributeChangedCallback = this.prototype.attributeChangedCallback;
this.prototype.attributeChangedCallback = function (name, oldValue, value) {
this.constructor[props].attributeChanged(this, name, oldValue, value);
_attributeChangedCallback?.call(this, name, oldValue, value);
};This is not only clumsy, it also doesn't play nicely with inheritance.
Similarly, it defines observedAttributes like this:
if (!Object.hasOwn(this, "observedAttributes")) {
Object.defineProperty(this, "observedAttributes", {
get: () => this[props].observedAttributes,
configurable: true,
});
}which overrides any existing observedAttributes.
Ideally, we should have a better story for plugins that want to…
- add side effects to an existing function
- add values to an existing object or array
Reactions are currently unavailable