Skip to content

Commit 50cd1b8

Browse files
committed
comments and lint tweaks
1 parent db6b4fe commit 50cd1b8

File tree

1 file changed

+17
-16
lines changed

1 file changed

+17
-16
lines changed

js/index.js

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const DEFAULTSETTINGS = {
1414
autoReload: false, // Automatically reload watch after app App Loader actions (removes "Hold button" prompt)
1515
noPackets: false, // Enable File Upload Compatibility mode (disables binary packet upload)
1616
};
17-
var SETTINGS = JSON.parse(JSON.stringify(DEFAULTSETTINGS)); // clone
17+
let SETTINGS = JSON.parse(JSON.stringify(DEFAULTSETTINGS)); // clone
1818

1919
let device = {
2020
id : undefined, // The Espruino device ID of this device, eg. BANGLEJS
@@ -39,7 +39,7 @@ let device = {
3939
"Alarm" : "Alarm"
4040
}
4141
};*/
42-
var LANGUAGE = undefined;
42+
let LANGUAGE = undefined;
4343

4444
function appJSONLoadedHandler() {
4545
appJSON.forEach(app => {
@@ -782,6 +782,7 @@ function showScreenshots(appId) {
782782

783783
// =========================================== My Apps
784784

785+
/** Upload the given app to the device - may prompt user for dependencies */
785786
function uploadApp(app, options) {
786787
options = options||{};
787788
if (app.type == "defaultconfig" && !options.force) {
@@ -823,22 +824,22 @@ function uploadApp(app, options) {
823824
});
824825
}
825826

827+
/** Prompt user and then remove app from the device */
826828
function removeApp(app) {
827-
return showPrompt("Delete","Really remove '"+app.name+"'?").then(() => {
828-
return getInstalledApps().then(()=>{
829-
// a = from appid.info, app = from apps.json
830-
return Comms.removeApp(device.appsInstalled.find(a => a.id === app.id));
829+
return showPrompt("Delete","Really remove '"+app.name+"'?")
830+
.then(() => getInstalledApps())
831+
.then(()=> Comms.removeApp(device.appsInstalled.find(a => a.id === app.id))) // a = from appid.info, app = from apps.json
832+
.then(()=>{
833+
device.appsInstalled = device.appsInstalled.filter(a=>a.id!=app.id);
834+
showToast(app.name+" removed successfully","success");
835+
refreshMyApps();
836+
refreshLibrary();
837+
}, err=>{
838+
showToast(app.name+" removal failed, "+err,"error");
831839
});
832-
}).then(()=>{
833-
device.appsInstalled = device.appsInstalled.filter(a=>a.id!=app.id);
834-
showToast(app.name+" removed successfully","success");
835-
refreshMyApps();
836-
refreshLibrary();
837-
}, err=>{
838-
showToast(app.name+" removal failed, "+err,"error");
839-
});
840840
}
841841

842+
/** Show window for a new app and finally upload it */
842843
function customApp(app) {
843844
return handleCustomApp(app).then((appJSON) => {
844845
if (appJSON) device.appsInstalled.push(appJSON);
@@ -852,7 +853,7 @@ function customApp(app) {
852853
});
853854
}
854855

855-
/* check for dependencies the app needs and install them if required
856+
/** check for dependencies the app needs and install them if required
856857
uploadOptions is an object, see AppInfo.checkDependencies for what can be in it
857858
*/
858859
function checkDependencies(app, uploadOptions) {
@@ -1405,4 +1406,4 @@ if (btn) btn.addEventListener("click",event=>{
14051406
document.querySelector(".editor__canvas").style.display = "inherit";
14061407
Comms.on("data",x=>Espruino.Core.Terminal.outputDataHandler(x))
14071408
Espruino.Core.Terminal.setInputDataHandler(function(d) { Comms.write(d); })
1408-
});
1409+
});

0 commit comments

Comments
 (0)