@@ -41,6 +41,7 @@ window.IonicDevServer = {
41
41
handleError : function ( err ) {
42
42
if ( ! err ) return ;
43
43
44
+ // Socket is ready so send this error to the server for prettifying
44
45
if ( this . socketReady ) {
45
46
var msg = {
46
47
category : 'runtimeError' ,
@@ -168,6 +169,9 @@ window.IonicDevServer = {
168
169
}
169
170
} ,
170
171
172
+ /**
173
+ * Process a build update message and display something to the friendly user.
174
+ */
171
175
buildUpdate : function ( msg ) {
172
176
var status = 'success' ;
173
177
@@ -187,6 +191,8 @@ window.IonicDevServer = {
187
191
this . buildingNotification ( false ) ;
188
192
189
193
var diagnosticsEle = document . getElementById ( 'ion-diagnostics' ) ;
194
+
195
+ // If we have an element but no html created yet
190
196
if ( diagnosticsEle && ! msg . data . diagnosticsHtml ) {
191
197
diagnosticsEle . classList . add ( 'ion-diagnostics-fade-out' ) ;
192
198
@@ -199,21 +205,24 @@ window.IonicDevServer = {
199
205
200
206
} else if ( msg . data . diagnosticsHtml ) {
201
207
202
- clearTimeout ( this . diagnosticsTimerId ) ;
208
+ // We don't have an element but we have diagnostics HTML, so create the error
203
209
204
210
if ( ! diagnosticsEle ) {
205
211
diagnosticsEle = document . createElement ( 'div' ) ;
206
212
diagnosticsEle . id = 'ion-diagnostics' ;
207
213
diagnosticsEle . className = 'ion-diagnostics-fade-out' ;
208
214
document . body . insertBefore ( diagnosticsEle , document . body . firstChild ) ;
209
-
210
- this . diagnosticsTimerId = setTimeout ( function ( ) {
211
- var diagnosticsEle = document . getElementById ( 'ion-diagnostics' ) ;
212
- if ( diagnosticsEle ) {
213
- diagnosticsEle . classList . remove ( 'ion-diagnostics-fade-out' ) ;
214
- }
215
- } , 24 ) ;
216
215
}
216
+
217
+ // Show the last error
218
+ clearTimeout ( this . diagnosticsTimerId ) ;
219
+ this . diagnosticsTimerId = setTimeout ( function ( ) {
220
+ var diagnosticsEle = document . getElementById ( 'ion-diagnostics' ) ;
221
+ if ( diagnosticsEle ) {
222
+ diagnosticsEle . classList . remove ( 'ion-diagnostics-fade-out' ) ;
223
+ }
224
+ } , 24 ) ;
225
+
217
226
diagnosticsEle . innerHTML = msg . data . diagnosticsHtml
218
227
}
219
228
}
0 commit comments