I'm trying to use the JavaScript SpeechSynthesis API in web_sys. In the actual API, window.SpeechSynthesis
is a singleton. You might, for instance, create a SpeechSynthesisUtterance
then call window.SpeechSynthesis.speak(utterance)
to speak it. You don't need a SpeechSynthesis
instance to do this.
But if you look at SpeechSynthesis in web_sys - Rust, it appears to need &self
as an initial argument, suggesting I need an instance of what in JavaScript is a singleton.
How am I meant to call this API? SpeechSynthesisUtterance
is easy as it has a new
method, but I don't see something similar for SpeechSynthesis
.
Thanks.