CommandEvent: command-Eigenschaft
Experimentell: Dies ist eine experimentelle Technologie
Überprüfen Sie die Browser-Kompatibilitätstabelle sorgfältig vor der Verwendung auf produktiven Webseiten.
Die schreibgeschützte command
-Eigenschaft des CommandEvent
-Interfaces gibt einen String zurück, der den Wert der command
-Eigenschaft zum Zeitpunkt der Ereignisauslösung enthält.
Wert
Ein String.
Beispiele
Im folgenden einfachen Beispiel haben wir einen Ereignislistener eingerichtet, der auf das "show-modal"-Kommando hört:
js
document.body.addEventListener(
"command",
(event) => {
const theAction = event.command;
if (theAction == "show-modal") {
console.log("Showing modal dialog");
}
},
{ capture: true },
);
Spezifikationen
Specification |
---|
HTML # dom-commandevent-command |
Browser-Kompatibilität
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
command |
Legend
Tip: you can click/tap on a cell for more information.
- No support
- No support
- Experimental. Expect behavior to change in the future.
- User must explicitly enable this feature.
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.