2019-11-29 17:55:52 +13: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.
|
2020-04-28 21:09:54 +12:00
|
|
|
import "../css/app.scss"
|
2019-11-29 17:55:52 +13:00
|
|
|
|
|
|
|
// webpack automatically bundles all modules in your
|
|
|
|
// entry points. Those entry points can be configured
|
|
|
|
// in "webpack.config.js".
|
|
|
|
//
|
2020-04-28 21:09:54 +12:00
|
|
|
// Import deps with the dep name or local files with a relative path, for example:
|
2019-11-29 17:55:52 +13:00
|
|
|
//
|
2020-04-28 21:09:54 +12:00
|
|
|
// import {Socket} from "phoenix"
|
|
|
|
// import socket from "./socket"
|
2019-11-29 17:55:52 +13:00
|
|
|
//
|
2019-12-01 17:11:36 +13:00
|
|
|
|
2020-04-28 21:09:54 +12:00
|
|
|
import jQuery from "jquery"
|
2019-12-02 18:42:51 +13:00
|
|
|
window.$ = jQuery;
|
|
|
|
import "what-input"
|
|
|
|
import "foundation-sites/js/foundation"
|
|
|
|
|
|
|
|
$(document).foundation();
|
2020-04-28 21:09:54 +12:00
|
|
|
|
|
|
|
import "phoenix_html"
|
|
|
|
import { Socket } from "phoenix"
|
|
|
|
import NProgress from "nprogress"
|
|
|
|
import { LiveSocket } from "phoenix_live_view"
|
|
|
|
|
|
|
|
let csrfToken = document.querySelector("meta[name='csrf-token']").getAttribute("content")
|
|
|
|
let liveSocket = new LiveSocket("/live", 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)
|
|
|
|
window.liveSocket = liveSocket
|