var appJSON = []; // List of apps and info from apps.json var appsInstalled = []; // list of app JSON var files = []; // list of files on Bangle httpGet("apps.json").then(apps=>{ try { appJSON = JSON.parse(apps); } catch(e) { console.log(e); showToast("App List Corrupted","error"); } appJSON.sort(appSorter); refreshLibrary(); }); // Status // =========================================== Top Navigation function showToast(message, type) { // toast-primary, toast-success, toast-warning or toast-error var style = "toast-primary"; if (type=="success") style = "toast-success"; else if (type=="error") style = "toast-error"; else if (type!==undefined) console.log("showToast: unknown toast "+type); var toastcontainer = document.getElementById("toastcontainer"); var msgDiv = htmlElement(`
`); msgDiv.innerHTML = message; toastcontainer.append(msgDiv); setTimeout(function() { msgDiv.remove(); }, 5000); } var progressToast; // the DOM element var progressSticky; // showProgress(,,"sticky") don't remove until hideProgress("sticky") var progressInterval; // the interval used if showProgress(..., "animate") var progressPercent; // the current progress percentage function showProgress(text, percent, sticky) { if (sticky=="sticky") progressSticky = true; if (!progressToast) { if (progressInterval) { clearInterval(progressInterval); progressInterval = undefined; } if (percent == "animate") { progressInterval = setInterval(function() { progressPercent += 2; if (progressPercent>100) progressPercent=0; showProgress(undefined, progressPercent); }, 100); percent = 0; } progressPercent = percent; var toastcontainer = document.getElementById("toastcontainer"); progressToast = htmlElement(`${escapeHtml(app.name)} ${versionInfo}
${escapeHtml(app.description)}
${escapeHtml(app.name)} (${version.text})
${escapeHtml(app.description)}