SpeechRecognitionEvent: resultIndex-Eigenschaft
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
Die resultIndex
-Eigenschaft des schreibgeschützten SpeechRecognitionEvent
-Interfaces gibt den niedrigsten Indexwert des Ergebnisses in der SpeechRecognitionResultList
-"Array" zurück, der tatsächlich geändert wurde.
Das SpeechRecognitionResultList
-Objekt ist kein Array, verfügt jedoch über einen Getter, der den Zugriff mit Array-Syntax ermöglicht.
Wert
Eine Zahl.
Beispiele
js
recognition.onresult = (event) => {
const color = event.results[0][0].transcript;
diagnostic.textContent = `Result received: ${color}.`;
bg.style.backgroundColor = color;
console.log(event.resultIndex); // returns 0 if there is only one result
};
Spezifikationen
Specification |
---|
Web Speech API # dom-speechrecognitionevent-resultindex |
Browser-Kompatibilität
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
resultIndex |
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.