hide loader after language was updated
This commit is contained in:
parent
6828476874
commit
a54a42950e
2
.gitignore
vendored
2
.gitignore
vendored
@ -28,3 +28,5 @@ node_modules/
|
|||||||
|
|
||||||
# production folder
|
# production folder
|
||||||
production/
|
production/
|
||||||
|
|
||||||
|
todo.md
|
||||||
@ -64,6 +64,8 @@ require( [
|
|||||||
LocalisationModel,
|
LocalisationModel,
|
||||||
localforage
|
localforage
|
||||||
) {
|
) {
|
||||||
|
var wasAppLoadComplete = false;
|
||||||
|
|
||||||
var imageModel = ImageModel();
|
var imageModel = ImageModel();
|
||||||
var glitchModel = GlitchModel();
|
var glitchModel = GlitchModel();
|
||||||
var shareModel = ShareModel();
|
var shareModel = ShareModel();
|
||||||
@ -107,12 +109,6 @@ require( [
|
|||||||
controlsView.loadInitialValues();
|
controlsView.loadInitialValues();
|
||||||
loadInitialItem();
|
loadInitialItem();
|
||||||
}
|
}
|
||||||
|
|
||||||
document.documentElement.classList.add( 'is-loaded' );
|
|
||||||
|
|
||||||
setTimeout( function () {
|
|
||||||
document.documentElement.classList.remove( 'is-loading' );
|
|
||||||
}, 10 );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// hooks up all messaging between items
|
// hooks up all messaging between items
|
||||||
@ -218,7 +214,9 @@ require( [
|
|||||||
.on( 'error', indicatorView.showError );
|
.on( 'error', indicatorView.showError );
|
||||||
|
|
||||||
localisationModel
|
localisationModel
|
||||||
.on( 'error', indicatorView.showError );
|
.on( 'error', indicatorView.showError )
|
||||||
|
.on( 'error', hideAppLoader )
|
||||||
|
.on( 'update', hideAppLoader );
|
||||||
}
|
}
|
||||||
|
|
||||||
function addCSSClasses () {
|
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();
|
init();
|
||||||
} );
|
} );
|
||||||
@ -9,7 +9,7 @@ define(
|
|||||||
|
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
var publishers = addPublishers( self, 'error' );
|
var publishers = addPublishers( self, 'update', 'error' );
|
||||||
|
|
||||||
var textElData = [ ];
|
var textElData = [ ];
|
||||||
var texts = '';
|
var texts = '';
|
||||||
@ -37,7 +37,6 @@ define(
|
|||||||
// if this is the first language to load, that's really bad.
|
// if this is the first language to load, that's really bad.
|
||||||
languageWasLoaded = true;
|
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?' );
|
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 ) {
|
success: function ( res ) {
|
||||||
languageLoaded( languageName, res );
|
languageLoaded( languageName, res );
|
||||||
@ -74,11 +73,12 @@ define(
|
|||||||
|
|
||||||
item.wasUpdated = true;
|
item.wasUpdated = true;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
textElData.splice( i, 1 );
|
textElData.splice( i, 1 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
publishers.update.dispatch();
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user