1

Is there any particular consideration against using the root node of the HTML document as a message bus for a web application? If this question is too generic please consider the case of a polymer MVC application.

As far as I can see the document is always guaranteed to be there and is easily accessible from everywhere, even from within the shadow dom. By contrast Polymer docs seem to want people to use a dedicated bus element that can be injected where necessary. In other words I'm not quite sure what advantages this approach would provide.

Renaud
  • 4,569
  • 7
  • 41
  • 72
  • Is there a reason why don't you want to use a dedicated element for this? – A. Rama Dec 15 '14 at 13:20
  • Using a dedicated element seems like an overhead to me, especially when interfacing with external elements. Also I can imagine there would be slight performance implications. – Renaud Dec 15 '14 at 13:28
  • Bah, I can't really imagine any situation where the overhead would be anything else than negligible. Nor there would be any performance loss that could be actually be measured. On the other hand, the document is available to all code and libraries and you shouldn't make assumptions that it's always left alone and untouched. – A. Rama Dec 15 '14 at 14:12

0 Answers0