mirror of https://github.com/espruino/BangleApps
fastload - Check setting.json and force real load on change
parent
907cea89d8
commit
b63ff956be
|
@ -12,6 +12,7 @@ This allows fast loading of all apps with two conditions:
|
||||||
* If Quick Launch is installed it can be excluded from app history
|
* If Quick Launch is installed it can be excluded from app history
|
||||||
* Allows to redirect all loads usually loading the clock to the launcher instead
|
* Allows to redirect all loads usually loading the clock to the launcher instead
|
||||||
* The "Fastloading..." screen can be switched off
|
* The "Fastloading..." screen can be switched off
|
||||||
|
* Enable checking `setting.json` and force a complete load on changes
|
||||||
|
|
||||||
## App history
|
## App history
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,15 @@ let loadingScreen = function(){
|
||||||
|
|
||||||
let cache = s.readJSON("fastload.cache") || {};
|
let cache = s.readJSON("fastload.cache") || {};
|
||||||
|
|
||||||
let checkApp = function(n){
|
const SYS_SETTINGS="setting.json";
|
||||||
|
|
||||||
|
let appFastloadPossible = function(n){
|
||||||
|
if(SETTINGS.detectSettingsChange && (!cache[SYS_SETTINGS] || E.CRC32(SYS_SETTINGS) != cache[SYS_SETTINGS])){
|
||||||
|
cache[SYS_SETTINGS] = E.CRC32(SYS_SETTINGS);
|
||||||
|
s.writeJSON("fastload.cache", cache);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// no widgets, no problem
|
// no widgets, no problem
|
||||||
if (!global.WIDGETS) return true;
|
if (!global.WIDGETS) return true;
|
||||||
let app = s.read(n);
|
let app = s.read(n);
|
||||||
|
@ -39,7 +47,7 @@ let slowload = function(n){
|
||||||
};
|
};
|
||||||
|
|
||||||
let fastload = function(n){
|
let fastload = function(n){
|
||||||
if (!n || checkApp(n)){
|
if (!n || appFastloadPossible(n)){
|
||||||
// Bangle.load can call load, to prevent recursion this must be the system load
|
// Bangle.load can call load, to prevent recursion this must be the system load
|
||||||
global.load = slowload;
|
global.load = slowload;
|
||||||
Bangle.load(n);
|
Bangle.load(n);
|
||||||
|
|
|
@ -59,6 +59,13 @@
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
mainmenu['Detect settings changes'] = {
|
||||||
|
value: !!settings.detectSettingsChange,
|
||||||
|
onchange: v => {
|
||||||
|
writeSettings("detectSettingsChange",v);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
return mainmenu;
|
return mainmenu;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue