- From: Mitar <mmitar@gmail.com>
- Date: Sat, 7 Nov 2015 01:01:37 -0800
- To: Domenic Denicola <d@domenic.me>
- Cc: public-webapps <public-webapps@w3.org>
Hi! On Fri, Nov 6, 2015 at 5:12 PM, Domenic Denicola <d@domenic.me> 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 side-effect: http://www.w3.org/TR/webmessaging/#examples "The key difference is that when using addEventListener(), the start() method must also be invoked. When using onmessage, the call to start() is implied." So we already have an example of an interface where "start()" is called automatically. So how can I do something like that on the custom element as well? > A better design in your case would probably be to have a specific method on the custom element which "starts" it (and thus starts its associated message port). For me this feels like leaking internal implementation details to the outside. Mitar -- http://mitar.tnode.com/ https://twitter.com/mitar_m
Received on Saturday, 7 November 2015 09:02:05 UTC