Ratchet launch: add caching
parent
dea770cb91
commit
4e2c3dc0c1
|
|
@ -9,7 +9,14 @@ var blankImage = Graphics.createImage(` `);
|
||||||
var rowHeight = g.getHeight()/3;
|
var rowHeight = g.getHeight()/3;
|
||||||
|
|
||||||
// Load apps list
|
// Load apps list
|
||||||
var apps = Storage.list(/\.info$/).map(app=>{
|
var apps;
|
||||||
|
|
||||||
|
var launchCache = s.readJSON("launch.cache.json", true)||{};
|
||||||
|
var launchHash = require("Storage").hash(/\.info/);
|
||||||
|
if (launchCache.hash==launchHash) {
|
||||||
|
apps = launchCache.apps;
|
||||||
|
} else {
|
||||||
|
apps = Storage.list(/\.info$/).map(app=>{
|
||||||
var a=Storage.readJSON(app,1);
|
var a=Storage.readJSON(app,1);
|
||||||
return a&&{
|
return a&&{
|
||||||
name:a.name,
|
name:a.name,
|
||||||
|
|
@ -31,6 +38,10 @@ apps.sort((a,b)=>{
|
||||||
return 0;
|
return 0;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
launchCache = { apps, hash: launchHash };
|
||||||
|
s.writeJSON("launch.cache.json", launchCache);
|
||||||
|
}
|
||||||
|
|
||||||
// Uncomment for testing in the emulator without apps:
|
// Uncomment for testing in the emulator without apps:
|
||||||
// apps = [
|
// apps = [
|
||||||
// {
|
// {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue