Re: The getVoices method should be asynchronous.

Eitan said he agrees - any other opinions?

Let's make the change shortly if there are no objections.




On Tue, May 21, 2013 at 9:01 AM, Dominic Mazzoni <dmazzoni@google.com>wrote:

> I filed the following bug, does anyone have any thoughts?
>
> https://www.w3.org/Bugs/Public/show_bug.cgi?id=22003
>
> The getVoices method should be asynchronous.
>
> As it is right now, user agents have three choices, all bad:
>
> 1. They can pre-load speech synthesis, which slows down application
> startup even though most web pages don't speak.
> 2. They can block until the list of voices is available, which can make
> the browser appear sluggish and potentially freeze script execution on that
> page for tens of milliseconds.
> 3. They can return an empty list and update it as soon as the complete
> list of voices is available.
>
> I propose that getVoices take a callback as an argument, so you'd use it
> like this:
>
> window.speechSynthesis.getVoices(function(voices) {
>   for (var i = 0; i < voices.length; i++)
>     ...
> });
>
> If the callback is unspecified, we could allow it to be used synchronously
> - and we should recommend browsers adopt either #2 or #3. Alternatively, we
> could just remove support for the synchronous form, and require the
> callback.
>
>

Received on Tuesday, 28 May 2013 08:14:42 UTC