sidebarAction.close()
Schließt die Seitenleiste im aktiven Fenster, falls es sich um die eigene Seitenleiste der Erweiterung handelt.
Diese Funktion kann nur innerhalb des Handlers für eine Benutzeraktion aufgerufen werden.
Dies ist eine asynchrone Funktion, die ein Promise
zurückgibt.
Syntax
js
browser.sidebarAction.close()
Parameter
Keine.
Rückgabewert
Ein Promise
, das ohne Argumente aufgelöst wird.
Browser-Kompatibilität
Report problems with this compatibility data on GitHubdesktop | mobile | ||||||
---|---|---|---|---|---|---|---|
close |
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.
Beispiele
Schließen Sie die Seitenleiste, wenn der Benutzer ein Kontextmenüelement auswählt:
js
browser.menus.create({
id: "close-sidebar",
title: "close sidebar",
contexts: ["all"],
});
browser.menus.onClicked.addListener(() => {
browser.sidebarAction.close();
});