[w3c/webcomponents] Disconnected Events (#678)

Would it be possible to emit `disconnected` events on a node? I'd like to be able to do something like the following:

```js
class MyComponent extends HTMLElement {
 
  connectedCallback() {
    framework
      .subscribe(['some', 'data'])
      .map(([some, data]) => node.state = { some, data ...node.state })
      .map(node.draw)
      .until(node.once('disconnected'))
   }

 async render(node, { some, data }) {
  // update component here
 }
}
```

(`node.on/once` is just simply creating a stream/promise of event(s) from the DOM element)

This can obviously done with some wrapper but it would be nice if it didn't need that. Also I'm not sure if this can be done for all elements rather than just custom elements?

Related: [Don't Unsubscribe](https://medium.com/@benlesh/rxjs-dont-unsubscribe-6753ed4fda87)

-- 
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/678

Received on Tuesday, 31 October 2017 00:08:57 UTC