sidebarAction.isOpen()
Returns true
if the extension's sidebar is open in a given window.
This function accepts a windowId
as a parameter:
- If you supply
windowId
, the function will check the given browser window. - If you omit
windowId
, the function will check the topmost browser window.
This is an asynchronous function that returns a Promise
.
Syntax
js
let gettingIsOpen = browser.sidebarAction.isOpen(
details // object
)
Parameters
details
-
object
. An object optionally containing thewindowId
to check.windowId
Optional-
integer
. ID of a browser window to check. If omitted defaults towindows.WINDOW_ID_CURRENT
, which refers to the topmost browser window.
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
Report problems with this compatibility data on GitHubdesktop | mobile | ||||||
---|---|---|---|---|---|---|---|
isOpen |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
- No support
- No support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Examples
Check the topmost window:
js
browser.sidebarAction.isOpen({}).then((result) => {
console.log(result);
});
Check all open windows:
js
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);
}
});