docs.rodeo

MDN Web Docs mirror

sidebarAction.isOpen()

{{AddonSidebar}} 

Returns true if the extension’s sidebar is open in a given window.

This function accepts a windowId as a parameter:

This is an asynchronous function that returns a Promise.

Syntax

let gettingIsOpen = browser.sidebarAction.isOpen(
  details // object
)

Parameters

Return value

A Promise that will be fulfilled with true if the extension’s sidebar is open in the given window, or false otherwise.

Browser compatibility

{{Compat}} 

Examples

Check the topmost window:

browser.sidebarAction.isOpen({}).then((result) => {
  console.log(result);
});

Check all open windows:

async function checkWindow(windowId) {
  const result = await browser.sidebarAction.isOpen({ windowId });
  console.log(`window: ${windowId} status: ${result}`);
}

browser.windows.getAll().then((all) => {
  for (const { id } of all) {
    checkWindow(id);
  }
});

{{WebExtExamples}} 

In this article

View on MDN