Class Instance and Event Manager for JS
Currently we have a lot of the following happening:
- Double/triple etc... instantiation of classes
- Double/triple etc... registration of events.
This happens when you use turbolinks because the page changes but the javascript never gets dump.
A simple boring solution to this would be to make a central location for all instances and events. On page:change
we dump the necessary js instances and events.
Config settings will allow you to keep/dump events and instances through a page change.
This issue is of high importance because we currently have this happening and causing problems in our codebase.
I imagine that the script itself does not need to be big.
cc @alfredo1 @annabeldunstone @iamphill @elvongray @dzaporozhets @rspeicher