- From: Andrea Giammarchi <notifications@github.com>
- Date: Thu, 25 Mar 2021 01:02:00 -0700
- To: WICG/webcomponents <webcomponents@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Thursday, 25 March 2021 08:02:16 UTC
P.S. I really like the literal API proposal, because it allows the Behavior class to eventually have those methods and be the argument passed along to `new ElementObserver(behavior)` ... heck, expanding the API to accept attributes and a filter, would basically replace Custom Elements and/or the need of a globally shared registry.
```js
const eo = new ElementObserver({
attributeChangedCallback(element, name, oldValue, newValue) {
},
connectedCallback(element) {
// do things with element
},
disconnectedCallback(element) {
// do things with element
}
});
eo.observe(element, {
attributes: true,
attributesFilter: ['only', 'these', 'attributes']
});
```
I think I'll play around a bit with this, also making `connectedCallback` and `disconnectedCallback` optional through the configuration object (hints for the property name welcome).
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/WICG/webcomponents/issues/509#issuecomment-806447334
Received on Thursday, 25 March 2021 08:02:16 UTC