16
16
//
17
17
18
18
// Include phoenix_html to handle method=PUT/DELETE in forms and buttons.
19
- import " phoenix_html"
19
+ import ' phoenix_html'
20
20
// Establish Phoenix Socket and LiveView configuration.
21
- import { Socket } from " phoenix"
22
- import { LiveSocket } from " phoenix_live_view"
23
- import topbar from " topbar"
21
+ import { Socket } from ' phoenix'
22
+ import { LiveSocket } from ' phoenix_live_view'
23
+ import topbar from ' topbar'
24
24
import Alpine from 'alpinejs'
25
25
import { themeChange } from 'theme-change'
26
- import * as Hooks from " ./hooks/index"
26
+ import * as Hooks from ' ./hooks/index'
27
27
28
28
window . Alpine = Alpine
29
29
Alpine . start ( )
30
30
31
31
themeChange ( )
32
32
33
- let csrfToken = document . querySelector ( "meta[name='csrf-token']" ) . getAttribute ( " content" )
34
- let liveSocket = new LiveSocket ( " /live" , Socket , {
33
+ const csrfToken = document . querySelector ( "meta[name='csrf-token']" ) . getAttribute ( ' content' )
34
+ const liveSocket = new LiveSocket ( ' /live' , Socket , {
35
35
longPollFallbackMs : 2500 ,
36
36
params : { _csrf_token : csrfToken } ,
37
37
dom : {
38
- onBeforeElUpdated ( from , to ) {
38
+ onBeforeElUpdated ( from , to ) {
39
39
if ( from . _x_dataStack ) {
40
40
window . Alpine . clone ( from , to )
41
41
}
@@ -45,9 +45,9 @@ let liveSocket = new LiveSocket("/live", Socket, {
45
45
} )
46
46
47
47
// Show progress bar on live navigation and form submits
48
- topbar . config ( { barColors : { 0 : " #29d" } , shadowColor : " rgba(0, 0, 0, .3)" } )
49
- window . addEventListener ( " phx:page-loading-start" , _info => topbar . show ( 300 ) )
50
- window . addEventListener ( " phx:page-loading-stop" , _info => topbar . hide ( ) )
48
+ topbar . config ( { barColors : { 0 : ' #29d' } , shadowColor : ' rgba(0, 0, 0, .3)' } )
49
+ window . addEventListener ( ' phx:page-loading-start' , _info => topbar . show ( 300 ) )
50
+ window . addEventListener ( ' phx:page-loading-stop' , _info => topbar . hide ( ) )
51
51
52
52
// Fix for mobile devices app height
53
53
const appHeight = ( ) => {
@@ -65,4 +65,3 @@ liveSocket.connect()
65
65
// >> liveSocket.enableLatencySim(1000) // enabled for duration of browser session
66
66
// >> liveSocket.disableLatencySim()
67
67
window . liveSocket = liveSocket
68
-
0 commit comments