Re: SpeechSynthesisCallback

static void speak(SpeechSynthesisUtterance utterance);
static void cancel();
static void pause();
static void resume();

Those shouldn't be static.





On 10/12/2012 01:42 PM, Olli Pettay wrote:
> On 10/12/2012 04:41 AM, Glen Shires wrote:
>> I propose the following change to the SpeechSynthesis IDL to use a callback instead of events. It doesn't change functionality, but does make the IDL
>> more well-defined and conventional. (The current IDL breaks platform conventions, because the speak() method makes a copy of utterance, and thus
>> event.target cannot be properly defined, nor can addEventListener be used in the conventional manner.)  The SpeechSynthesisEvent object is
>> renamed SpeechSynthesisUpdate (because it is no longer an event, but rather a callback).  If there's no disagreement, I'll update the spec with this
>> on Monday.
>>
>>      callback SpeechSynthesisCallback = void (SpeechSynthesisUpdate update);
>>
>>      interface SpeechSynthesis {
>>        ...
>>        static void speak(SpeechSynthesisUtterance utterance, SpeechSynthesisCallback callback);
>>      };
>>
>>      interface SpeechSynthesisUpdate {
>>          enum UpdateType {
>>            "start",
>>            "end",
>>            "pause",
>>            "resume",
>>            "mark",
>>            "boundary",
>>            "error"
>>          };
>>          readonly attribute UpdateType type;
>>          readonly attribute unsigned long charIndex;
>>          readonly attribute float elapsedTime;
>>          readonly attribute DOMString name;
>>      };
>>
>> /Glen Shires
>
> Looks odd to me.
>
> Shouldn't it be
> interface SpeechSynthesis : EventTarget
> {
>    void speak(SpeechSynthesisUtterance utterance);
>    EventHandler onspeak;
> }
>
> That way one doesn't need to pass callback to the speak method all the time.
> Just registering once is enough.
>
>
>
>
> -Olli
>

Received on Saturday, 13 October 2012 14:56:44 UTC