jessetane / unicodes

Browse all of the unicodes
66 stars 7 forks source link

Architecture question #4

Open jessetane opened 8 years ago

jessetane commented 8 years ago

I added a component to show the current block, and allow jumping directly to other blocks. Typically keeping components cleanly separated is easy enough as they only need information from the url to get themselves into the proper state. However this is not the case with the block selector, which is driven by and directly affects only the chart component (irrespective of the url). I like being able to declaratively specify where the component is located in the DOM with HTML, but feel a bit funny about how tightly coupled it is with the chart. I decided that I was overthinking things (there is only ever one instance of each component in this app) and used document.querySelector to grab a module scoped reference to the chart, but I'd be interested to hear other ideas for dealing with component inter-dependencies like this!

jessetane commented 8 years ago

https://github.com/jessetane/unicodes/blob/master/src/blocks/index.js#L5

jessetane commented 8 years ago

Maybe use window.dispatchEvent?