hide loader after language was updated
This commit is contained in:
parent
6828476874
commit
a54a42950e
4
.gitignore
vendored
4
.gitignore
vendored
@ -27,4 +27,6 @@ $RECYCLE.BIN/
|
||||
node_modules/
|
||||
|
||||
# production folder
|
||||
production/
|
||||
production/
|
||||
|
||||
todo.md
|
||||
@ -64,6 +64,8 @@ require( [
|
||||
LocalisationModel,
|
||||
localforage
|
||||
) {
|
||||
var wasAppLoadComplete = false;
|
||||
|
||||
var imageModel = ImageModel();
|
||||
var glitchModel = GlitchModel();
|
||||
var shareModel = ShareModel();
|
||||
@ -107,12 +109,6 @@ require( [
|
||||
controlsView.loadInitialValues();
|
||||
loadInitialItem();
|
||||
}
|
||||
|
||||
document.documentElement.classList.add( 'is-loaded' );
|
||||
|
||||
setTimeout( function () {
|
||||
document.documentElement.classList.remove( 'is-loading' );
|
||||
}, 10 );
|
||||
}
|
||||
|
||||
// hooks up all messaging between items
|
||||
@ -218,7 +214,9 @@ require( [
|
||||
.on( 'error', indicatorView.showError );
|
||||
|
||||
localisationModel
|
||||
.on( 'error', indicatorView.showError );
|
||||
.on( 'error', indicatorView.showError )
|
||||
.on( 'error', hideAppLoader )
|
||||
.on( 'update', hideAppLoader );
|
||||
}
|
||||
|
||||
function addCSSClasses () {
|
||||
@ -327,5 +325,18 @@ require( [
|
||||
}
|
||||
}
|
||||
|
||||
function hideAppLoader () {
|
||||
if ( ! wasAppLoadComplete ) {
|
||||
requestAnimationFrame ( function () {
|
||||
wasAppLoadComplete = true;
|
||||
document.documentElement.classList.add( 'is-loaded' );
|
||||
|
||||
setTimeout( function () {
|
||||
document.documentElement.classList.remove( 'is-loading' );
|
||||
}, 10 );
|
||||
} );
|
||||
}
|
||||
}
|
||||
|
||||
init();
|
||||
} );
|
||||
@ -9,7 +9,7 @@ define(
|
||||
|
||||
var self = this;
|
||||
|
||||
var publishers = addPublishers( self, 'error' );
|
||||
var publishers = addPublishers( self, 'update', 'error' );
|
||||
|
||||
var textElData = [ ];
|
||||
var texts = '';
|
||||
@ -37,7 +37,6 @@ define(
|
||||
// if this is the first language to load, that's really bad.
|
||||
languageWasLoaded = true;
|
||||
publishers.error.dispatch( 'I\'m really sorry. I failed to load the language file for ' + languageName + '. This is a serious error that makes the app very hard to use. Maybe you can try reloading?' );
|
||||
|
||||
},
|
||||
success: function ( res ) {
|
||||
languageLoaded( languageName, res );
|
||||
@ -74,11 +73,12 @@ define(
|
||||
|
||||
item.wasUpdated = true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
textElData.splice( i, 1 );
|
||||
}
|
||||
}
|
||||
|
||||
publishers.update.dispatch();
|
||||
} );
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user