Expose existance & status of menu item in a condition or API call

Now it works. Thank you!

Now I have a good template I can use for a variety of app menus.

In case anyone is interested, I made an object-oriented version:

class magnifier {
  constructor() {
    this.root = 'View;Magnification';
    this.min = 1;  // 2^0
    this.max = 8;  // 2^3
  }

  async isChecked(value) {
    const status = await get_menu_item_details(`${this.root};${value}x`);
    return JSON.parse(status).checked === true;
  }

  async current() {
    for (let bit = 0; bit < 4; bit++) {
      const value = 1 << bit;
      if (await this.isChecked(value)) return value;
    }
  }

  async trigger(value) {
    return trigger_action({
      json: JSON.stringify({
        BTTPredefinedActionType: 124,
        BTTMenubarPath: `${this.root};${value}x`
      }),
      wait_for_reply: false
    });
  }

  async change(delta) {
    var value = await this.current();
    if (delta > 0) {value = Math.min(this.max, value << 1)};
    if (delta < 0) {value = Math.max(this.min, value >> 1)};
    await this.trigger(value);
    returnToBTT(true);
  }
}

async function zoomIn() {
  await new magnifier().change(+1);
}

async function zoomOut() {
  await new magnifier().change(-1);
}