Add method to manage cache
This commit is contained in:
parent
427062ff9d
commit
5eea446645
3 changed files with 41 additions and 5 deletions
|
@ -1,7 +1,5 @@
|
||||||
CACHE MANIFEST
|
CACHE MANIFEST
|
||||||
|
# Date : 2014/11/22 - Version : 11
|
||||||
NETWORK:
|
|
||||||
*
|
|
||||||
|
|
||||||
CACHE:
|
CACHE:
|
||||||
index.html
|
index.html
|
||||||
|
@ -45,3 +43,5 @@ inc/lib/uuid.js
|
||||||
inc/lib/typeahead.bundle.js
|
inc/lib/typeahead.bundle.js
|
||||||
inc/lib/moment.min.js
|
inc/lib/moment.min.js
|
||||||
|
|
||||||
|
NETWORK:
|
||||||
|
*
|
||||||
|
|
36
inc/myco.js
36
inc/myco.js
|
@ -950,6 +950,35 @@ pleaseWaitHide=function() {
|
||||||
$('#please_wait_modal').modal('hide');
|
$('#please_wait_modal').modal('hide');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**************************
|
||||||
|
* Cache / Update
|
||||||
|
*************************/
|
||||||
|
|
||||||
|
onUpdateReady=function() {
|
||||||
|
myconfirm(
|
||||||
|
"Une nouvelle version de l'application est disponible. Voulez-vous lancer la mise à jour ?",
|
||||||
|
onConfirmUpdate,null,{}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
onConfirmUpdate=function() {
|
||||||
|
window.applicationCache.swapCache();
|
||||||
|
location.reload();
|
||||||
|
}
|
||||||
|
|
||||||
|
_checkForUpgrade=false;
|
||||||
|
updateApp = function() {
|
||||||
|
_checkForUpgrade=true;
|
||||||
|
window.applicationCache.update();
|
||||||
|
}
|
||||||
|
|
||||||
|
onNoUpdate = function() {
|
||||||
|
if (_checkForUpgrade) {
|
||||||
|
_checkForUpgrade=false;
|
||||||
|
alert('Aucune mise à jour disponible');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*********************
|
/*********************
|
||||||
* Activate
|
* Activate
|
||||||
*********************/
|
*********************/
|
||||||
|
@ -1030,4 +1059,11 @@ $( document ).ready( function() {
|
||||||
|
|
||||||
view_home();
|
view_home();
|
||||||
pleaseWaitHide();
|
pleaseWaitHide();
|
||||||
|
|
||||||
|
$('#update_app').bind('click',updateApp);
|
||||||
|
window.applicationCache.addEventListener('updateready', onUpdateReady);
|
||||||
|
window.applicationCache.addEventListener('noupdate', onNoUpdate);
|
||||||
|
if(window.applicationCache.status === window.applicationCache.UPDATEREADY) {
|
||||||
|
onUpdateReady();
|
||||||
|
}
|
||||||
} );
|
} );
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<!--<html manifest="cache.manifest">-->
|
<html manifest="cache.manifest">
|
||||||
<html>
|
|
||||||
<head>
|
<head>
|
||||||
<title>MyCo</title>
|
<title>MyCo</title>
|
||||||
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />
|
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />
|
||||||
|
@ -186,6 +185,7 @@ span.cat-color {
|
||||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><span class='glyphicon glyphicon-user'></span> <span id='user-name'>Connexion</span> <b class="caret"></b></a>
|
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><span class='glyphicon glyphicon-user'></span> <span id='user-name'>Connexion</span> <b class="caret"></b></a>
|
||||||
<ul id="user-menu" class="dropdown-menu"></ul>
|
<ul id="user-menu" class="dropdown-menu"></ul>
|
||||||
</li>
|
</li>
|
||||||
|
<li><a id='update_app'><span class='glyphicon glyphicon-refresh'></span> Mise à jour de l'application</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
</div><!--/.nav-collapse -->
|
</div><!--/.nav-collapse -->
|
||||||
|
|
Loading…
Reference in a new issue