Skip to content

theycallmehero/phoenix_live_view_singleton

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 

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

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%