recorder: handle missing widget

master
Rob Pilling 2023-07-24 20:39:46 +01:00
parent 4e6827735e
commit cfa871e204
1 changed files with 10 additions and 14 deletions

View File

@ -11,13 +11,10 @@
return {
name: "Bangle",
items: [
items: WIDGETS["recorder"] ? [
{
name: "Toggle",
get: () => {
const w = typeof WIDGETS !== "undefined" && WIDGETS["recorder"];
return w && w.isRecording() ? {
get: () => WIDGETS["recorder"].isRecording() ? {
text: "Recording",
short: "rec",
img: recimg(),
@ -25,7 +22,6 @@
text: "Paused",
short: "paused",
img: pauseimg(),
}
},
run: () => {
const w = WIDGETS["recorder"];
@ -35,6 +31,6 @@
show: () => {},
hide: () => {},
},
],
] : [],
};
});