File tree Expand file tree Collapse file tree 3 files changed +32
-15
lines changed Expand file tree Collapse file tree 3 files changed +32
-15
lines changed Original file line number Diff line number Diff line change 36
36
</div >
37
37
</div >
38
38
<div class =" app__footer" >
39
+ <div class =" app__footer-message" />
39
40
<div
40
41
class =" app__version-item"
41
42
v-for =" (version, name) in versions"
@@ -65,7 +66,7 @@ export default {
65
66
},
66
67
67
68
data () {
68
- return deserializeState (location .hash .slice (1 ))
69
+ return deserializeState (window . location .hash .slice (1 ))
69
70
},
70
71
71
72
computed: {
@@ -129,24 +130,23 @@ export default {
129
130
},
130
131
131
132
onEditorInitialize () {
132
- this . $emit ( " initialize " )
133
+ window . MainContent . show ( )
133
134
},
134
135
135
136
onConfigChange () {
136
137
this .applyUrlHash ()
137
138
},
138
139
139
140
onUrlHashChange () {
140
- const newSerializedState = location .hash .slice (1 )
141
+ const newSerializedState = window . location .hash .slice (1 )
141
142
const oldSerializedState = serializeState (this .$data )
142
-
143
143
if (newSerializedState !== oldSerializedState) {
144
144
Object .assign (this .$data , deserializeState (newSerializedState))
145
145
}
146
146
},
147
147
148
148
applyUrlHash () {
149
- location .hash = ` #${ serializeState (this .$data )} `
149
+ window . location .hash = ` #${ serializeState (this .$data )} `
150
150
},
151
151
},
152
152
}
@@ -216,9 +216,12 @@ a:hover {
216
216
217
217
.app__footer {
218
218
display : flex ;
219
- justify-content : flex-end ;
220
219
border-top : 1px solid #CCC ;
221
220
}
221
+ .app__footer-message {
222
+ flex-grow : 1 ;
223
+ color : #B71C1C ;
224
+ }
222
225
.app__version-item {
223
226
margin-right : 8px ;
224
227
}
Original file line number Diff line number Diff line change 143
143
SplashScreen = undefined
144
144
MainContent = undefined
145
145
}
146
- } ) ( window . SplashScreen , window . MainContent )
146
+ } ) ( SplashScreen , MainContent )
147
+
148
+ // Check update.
149
+ window . addEventListener ( "load" , function ( ) {
150
+ applicationCache . addEventListener ( "updateready" , function ( ) {
151
+ if ( applicationCache . status == applicationCache . UPDATEREADY ) {
152
+ applicationCache . swapCache ( )
153
+
154
+ var footer = document . querySelector ( ".app__footer-message" )
155
+ if ( footer ) {
156
+ footer . textContent = "Please reload because a new version of this site is available."
157
+ }
158
+ }
159
+ } )
160
+ } )
161
+
162
+ // Show loading error.
163
+ function onLoadError ( ) {
164
+ MainContent . innerHTML = "Failed to load. Please ensure you are using the browser which supports ES2015."
165
+ MainContent . show ( )
166
+ }
147
167
</ script >
148
- < script src ="index.js " async > </ script >
168
+ < script src ="index.js " async onerror =" onLoadError " > </ script >
149
169
</ body >
150
170
151
171
</ html >
Original file line number Diff line number Diff line change @@ -2,11 +2,5 @@ import Vue from "vue"
2
2
import App from "./app.vue"
3
3
4
4
new Vue ( {
5
- render : ( h ) => h ( App , {
6
- on : {
7
- initialize ( ) {
8
- window . MainContent . show ( )
9
- } ,
10
- } ,
11
- } ) ,
5
+ render : ( h ) => h ( App ) ,
12
6
} ) . $mount ( "#main" )
You can’t perform that action at this time.
0 commit comments