2020-09-12 18:43:17 -04:00
|
|
|
// We need to import the CSS so that webpack will load it.
|
|
|
|
// The MiniCssExtractPlugin is used to separate it out into
|
|
|
|
// its own CSS file.
|
2021-02-24 11:46:13 -05:00
|
|
|
import "../css/app.scss";
|
2020-09-12 18:43:17 -04:00
|
|
|
|
2021-02-25 16:03:03 -05:00
|
|
|
// Import icons for sprite-loader
|
|
|
|
// brand icon
|
|
|
|
import "../node_modules/@fortawesome/fontawesome-free/svgs/solid/skull-crossbones.svg";
|
|
|
|
|
2020-09-12 18:43:17 -04:00
|
|
|
// webpack automatically bundles all modules in your
|
|
|
|
// entry points. Those entry points can be configured
|
|
|
|
// in "webpack.config.js".
|
|
|
|
//
|
|
|
|
// Import deps with the dep name or local files with a relative path, for example:
|
|
|
|
//
|
|
|
|
// import {Socket} from "phoenix"
|
|
|
|
// import socket from "./socket"
|
|
|
|
//
|
2021-02-24 11:46:13 -05:00
|
|
|
import "phoenix_html";
|
|
|
|
import { Socket } from "phoenix";
|
|
|
|
import topbar from "topbar";
|
|
|
|
import { LiveSocket } from "phoenix_live_view";
|
2020-09-12 18:43:17 -04:00
|
|
|
|
2021-02-25 15:27:31 -05:00
|
|
|
// Bootstrap v5 js imports
|
2021-02-25 15:39:38 -05:00
|
|
|
import "bootstrap/js/dist/collapse";
|
|
|
|
import "bootstrap/js/dist/dropdown";
|
2021-02-25 15:27:31 -05:00
|
|
|
|
|
|
|
// LiveSocket setup
|
2021-02-24 11:46:13 -05:00
|
|
|
let csrfToken = document
|
|
|
|
.querySelector("meta[name='csrf-token']")
|
|
|
|
.getAttribute("content");
|
|
|
|
let liveSocket = new LiveSocket("/live", Socket, {
|
|
|
|
params: { _csrf_token: csrfToken },
|
|
|
|
});
|
2020-09-12 18:43:17 -04:00
|
|
|
|
|
|
|
// Show progress bar on live navigation and form submits
|
2021-02-24 11:46:13 -05:00
|
|
|
topbar.config({ barColors: { 0: "#29d" }, shadowColor: "rgba(0, 0, 0, .3)" });
|
|
|
|
window.addEventListener("phx:page-loading-start", (info) => topbar.show());
|
|
|
|
window.addEventListener("phx:page-loading-stop", (info) => topbar.hide());
|
2020-09-12 18:43:17 -04:00
|
|
|
|
|
|
|
// connect if there are any LiveViews on the page
|
2021-02-24 11:46:13 -05:00
|
|
|
liveSocket.connect();
|
2020-09-12 18:43:17 -04:00
|
|
|
|
|
|
|
// 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()
|
2021-02-24 11:46:13 -05:00
|
|
|
window.liveSocket = liveSocket;
|