-
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
working using copy of app.js and hardcoding the data-phx-main div int…
…o the view template
- Loading branch information
Showing
9 changed files
with
368 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import "phoenix_html" | ||
import { Socket } from "phoenix" | ||
import NProgress from "nprogress" | ||
import { LiveSocket } from "phoenix_live_view" | ||
|
||
const url = "ws://localhost:3003/live" | ||
// const url = "/live" | ||
console.log("connecting to ", url); | ||
|
||
let csrfToken = document.querySelector("meta[name='csrf-token']").getAttribute("content") | ||
let liveSocket = new LiveSocket(url, Socket, { params: { _csrf_token: csrfToken } }) | ||
|
||
// Show progress bar on live navigation and form submits | ||
window.addEventListener("phx:page-loading-start", info => NProgress.start()) | ||
window.addEventListener("phx:page-loading-stop", info => NProgress.done()) | ||
|
||
// 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) | ||
// @ts-ignore | ||
window.liveSocket = liveSocket |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.