Re: Callback when an event handler has been added to a custom element

2015-11-07 Thread Mitar
Hi! On Fri, Nov 6, 2015 at 5:12 PM, Domenic Denicola wrote: > In general I would be cautious about this kind of API. Events are not > expected to have side effects, and adding listeners should not cause an > (observable) action. Hm, but message port API itself has such a

RE: Callback when an event handler has been added to a custom element

2015-11-07 Thread Domenic Denicola
From: Mitar [mailto:mmi...@gmail.com] > Hm, but message port API itself has such a side-effect: I think that is just a very bad API. The platform is unfortunately full of bad APIs :). In particular, a difference between two different ways of adding event listeners is not something authors

RE: Callback when an event handler has been added to a custom element

2015-11-06 Thread Domenic Denicola
In general I would be cautious about this kind of API. Events are not expected to have side effects, and adding listeners should not cause an (observable) action. See e.g. https://dom.spec.whatwg.org/#action-versus-occurance which tries to explain this in some detail. A better design in your

Re: Callback when an event handler has been added to a custom element

2015-11-06 Thread Elliott Sprehn
On Fri, Nov 6, 2015 at 5:12 PM, Domenic Denicola wrote: > In general I would be cautious about this kind of API. Events are not > expected to have side effects, and adding listeners should not cause an > (observable) action. See e.g. >

Re: Callback when an event handler has been added to a custom element

2015-11-06 Thread Justin Fagnani
t; -Original Message- > From: Mitar [mailto:mmi...@gmail.com] > Sent: Thursday, November 5, 2015 4:05 PM > To: public-webapps <public-webapps@w3.org> > Subject: Callback when an event handler has been added to a custom element > > Hi! > > We are using message ports to

Re: Callback when an event handler has been added to a custom element

2015-11-06 Thread Olli Pettay
er 5, 2015 4:05 PM To: public-webapps <public-webapps@w3.org <mailto:public-webapps@w3.org>> Subject: Callback when an event handler has been added to a custom element Hi! We are using message ports to communicate with our logic and are wrapping the API into a custom element. T

Re: Callback when an event handler has been added to a custom element

2015-11-06 Thread Justin Fagnani
[mailto:mmi...@gmail.com <mailto:mmi...@gmail.com>] >> Sent: Thursday, November 5, 2015 4:05 PM >> To: public-webapps <public-webapps@w3.org > public-webapps@w3.org>> >> Subject: Callback when an event handler has been added to a custom >> element &g

Re: Callback when an event handler has been added to a custom element

2015-11-06 Thread Boris Zbarsky
On 11/6/15 3:44 PM, Olli Pettay wrote: You need to override addEventListener on EventTarget, and also relevant onfoo EventHandler setters on Window and Document and *Element prototypes Are we trying to just do this best-effort, or reliably? Because this: var ifr =

Re: Callback when an event handler has been added to a custom element

2015-11-06 Thread Jonas Sicking
On Fri, Nov 6, 2015 at 12:44 PM, Olli Pettay wrote: > On 11/06/2015 09:28 PM, Justin Fagnani wrote: >> >> You can also override addEventListener/removeEventListener on your >> element. My concern with that, and possibly an event listener change >> callback, is >> that it only

RE: Callback when an event handler has been added to a custom element

2015-11-05 Thread Travis Leithead
- From: Mitar [mailto:mmi...@gmail.com] Sent: Thursday, November 5, 2015 4:05 PM To: public-webapps <public-webapps@w3.org> Subject: Callback when an event handler has been added to a custom element Hi! We are using message ports to communicate with our logic and are wrapping the API into a

Callback when an event handler has been added to a custom element

2015-11-05 Thread Mitar
Hi! We are using message ports to communicate with our logic and are wrapping the API into a custom element. The issue is that we would like to call start on a message port only after user has registered an event handler on the custom element instance. But it seems there is no way to get a