SpeechSynthesis: pending プロパティ
Baseline
Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since 2018年9月.
pending は SpeechSynthesis インターフェイスの読み取り専用プロパティで、論理値を返します。この発話キューにまだ発話されていない発話がある場合に true を返します。
値
論理値です。
例
js
const synth = window.speechSynthesis;
const utterance1 = new SpeechSynthesisUtterance(
"こう言ってみてはどうでしょうか?これを言うと、かなり長い文章になります。",
);
const utterance2 = new SpeechSynthesisUtterance("念のため、もう一言言います。");
synth.speak(utterance1);
synth.speak(utterance2);
const amIPending = synth.pending; // utterance1 がまだ話されている最中で、utterance2 がキューに入っている場合、true を返します
仕様書
| Specification |
|---|
| Web Speech API> # dom-speechsynthesis-pending> |