Description
I've been playing around with on-the-fly D3 vizualizations: Changes to data are announced by server via a WebSocket notification. Upon receiving the notification, clients may download a fresh dataset, and update their vizualization.
The WebSocket needs to be opened at some point while initializing/mounting the viz component, and also needs to be closed when unmounting. I have been able to do this by wrapping rid3/viz
into another component to manage the WS state, but it feels like a slight bodge.
It seems more lifecycle hooks, say for the :svg
element would make these need-cleanup scenarios easier. However, while pondering whether the whole WebSocket idea is not overly complicated, I started to wonder if the lack of said hooks was not intentional.
So basically:
- I'm seeking your thoughts on adding more top-level lifecycle methods (in
:svg
hash-map most likely), and - if that seems like something rid3 would benefit from, I may cook up some patches.