sidebarAction.toggle()
Wechselt die Sichtbarkeit der Seitenleiste im aktiven Fenster, wenn die Seitenleiste zur Erweiterung gehört.
Sie können diese Funktion nur innerhalb des Handlers für eine Benutzeraktion aufrufen.
Dies ist eine asynchrone Funktion, die ein Promise
zurückgibt.
Syntax
js
browser.sidebarAction.toggle()
Parameter
Keine.
Rückgabewert
Ein Promise
, das ohne Argumente aufgelöst wird.
Browser-Kompatibilität
Report problems with this compatibility data on GitHubdesktop | mobile | ||||||
---|---|---|---|---|---|---|---|
toggle |
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
Wechselt die Seitenleiste, wenn der Benutzer ein Element aus dem Kontextmenü auswählt:
js
browser.menus.create({
id: "toggle-sidebar",
title: "Toggle sidebar",
contexts: ["all"],
});
browser.menus.onClicked.addListener(() => {
browser.sidebarAction.toggle();
});