- From: Suguru Inatomi <notifications@github.com>
- Date: Mon, 23 Apr 2018 19:58:49 -0700
- To: w3c/webcomponents <webcomponents@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Tuesday, 24 April 2018 02:59:12 UTC
@hayatoito Just an idea, for example, I think `CustomEventRegistry` can be an EventTarget.
```
const xRegistry = new CustomElementRegistry();
class XFoo extends HTMLElement {
constructor() {
super();
this.addEventListener('click', () => {
// dispatch a scoped event
xRegistry.dispatchEvent(new CustomEvent('xEvent'))
});
}
}
class XBar extends HTMLElement {
constructor() {
super();
// subscribe scoped events
xRegistry.addEventListener('xEvent', () => {
// ...
});
}
}
xRegistry.define('x-foo', XFoo);
xRegistry.define('x-bar', XBar);
```

--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/webcomponents/issues/716#issuecomment-383787698
Received on Tuesday, 24 April 2018 02:59:12 UTC