mirror of
https://github.com/phfroidmont/scalive.git
synced 2025-12-25 13:36:59 +01:00
Ability to read websocket join messages
This commit is contained in:
parent
aae3db841b
commit
fadef26425
8 changed files with 158 additions and 52 deletions
|
|
@ -1,3 +1,27 @@
|
|||
import { scalive } from "core/js/index"
|
||||
import { Socket } from "phoenix"
|
||||
import { LiveSocket } from "phoenix_live_view"
|
||||
// import topbar from "../vendor/topbar"
|
||||
// import Calendar from "./hooks/calendar"
|
||||
|
||||
console.log(scalive)
|
||||
// let csrfToken =
|
||||
// document.querySelector("meta[name='csrf-token']").getAttribute("content")
|
||||
|
||||
let liveSocket = new LiveSocket("/live", Socket, {
|
||||
// params: { _csrf_token: csrfToken },
|
||||
// hooks: Hooks
|
||||
});
|
||||
|
||||
// Show progress bar on live navigation and form submits
|
||||
// topbar.config({ barColors: { 0: "#29d" }, shadowColor: "rgba(0, 0, 0, .3)" })
|
||||
// window.addEventListener("phx:page-loading-start", info => topbar.delayedShow(200))
|
||||
// window.addEventListener("phx:page-loading-stop", info => topbar.hide())
|
||||
|
||||
// connect if there are any LiveViews on the page
|
||||
liveSocket.connect()
|
||||
|
||||
|
||||
// expose liveSocket on window for web console debug logs and latency simulation:
|
||||
// >> liveSocket.enableDebug()
|
||||
// >> liveSocket.enableLatencySim(1000) // enabled for duration of browser session
|
||||
// >> liveSocket.disableLatencySim()
|
||||
window.liveSocket = liveSocket
|
||||
|
|
|
|||
1
example/js/src/dummy.ts
Normal file
1
example/js/src/dummy.ts
Normal file
|
|
@ -0,0 +1 @@
|
|||
// At least one ts files is needed so that mill doesn't set files in tsconfig.json to an empty array.
|
||||
Loading…
Add table
Add a link
Reference in a new issue