Skip to content

Latest commit

 

History

28 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

phoenix_live_view_singleton

The Phoenix LiveView JavaScript singleton client. Useful for adding hooks after init.

Installation

npm i phoenix_live_view_singleton

Usage

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: {..}
// }

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

4 watching

Forks

Releases

Packages

Used by

Contributors

Languages