mirror of https://github.com/espruino/BangleApps
remove undefined filter warning
parent
017643f452
commit
4c51cd29d8
32
loader.js
32
loader.js
|
@ -107,22 +107,24 @@ function filterAppsForDevice(deviceId) {
|
||||||
// set the device dropdown
|
// set the device dropdown
|
||||||
document.querySelector(".devicetype-nav span").innerText = device ? device.name : "All apps";
|
document.querySelector(".devicetype-nav span").innerText = device ? device.name : "All apps";
|
||||||
|
|
||||||
if (!device) {
|
if (originalAppJSON) { // JSON might not have loaded yet
|
||||||
if (deviceId!==undefined)
|
if (!device) {
|
||||||
showToast(`Device ID ${deviceId} not recognised. Some apps may not work`, "warning");
|
if (deviceId!==undefined)
|
||||||
appJSON = originalAppJSON;
|
showToast(`Device ID ${deviceId} not recognised. Some apps may not work`, "warning");
|
||||||
} else {
|
appJSON = originalAppJSON;
|
||||||
// Now filter apps
|
} else {
|
||||||
appJSON = originalAppJSON.filter(app => {
|
// Now filter apps
|
||||||
var supported = ["BANGLEJS"];
|
appJSON = originalAppJSON.filter(app => {
|
||||||
if (!app.supports) {
|
var supported = ["BANGLEJS"];
|
||||||
console.log(`App ${app.id} doesn't include a 'supports' field - ignoring`);
|
if (!app.supports) {
|
||||||
|
console.log(`App ${app.id} doesn't include a 'supports' field - ignoring`);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (app.supports.includes(deviceId)) return true;
|
||||||
|
//console.log(`Dropping ${app.id} because ${deviceId} is not in supported list ${app.supports.join(",")}`);
|
||||||
return false;
|
return false;
|
||||||
}
|
});
|
||||||
if (app.supports.includes(deviceId)) return true;
|
}
|
||||||
//console.log(`Dropping ${app.id} because ${deviceId} is not in supported list ${app.supports.join(",")}`);
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
refreshLibrary();
|
refreshLibrary();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue