The Phoenix LiveView JavaScript singleton client. Useful for adding hooks after init.
npm i phoenix_live_view_singleton
Add some hook
// file foo.js
import liveView from "phoenix_live_view_singleton"
liveView.hooks.SomeHook = {
..
}
Add more hooks in other file
// file bar.js
import liveView from "phoenix_live_view_singleton"
liveView.hooks.OtherHook = {
..
}
liveView.hooks.AndMore = {
..
}
Connect somewhere
// file buz.js
import liveView from "phoenix_live_view_singleton"
liveView.connect()
console.log(liveView.hooks)
// {
// SomeHook: {..},
// OtherHook: {..},
// AndMore: {..}
// }