- From: James Craig <jcraig@apple.com>
- Date: Wed, 03 Apr 2013 16:53:06 -0700
- To: public-speech-api@w3.org
- Cc: Chris Fleizach <cfleizach@apple.com>
Received on Wednesday, 3 April 2013 23:54:14 UTC
Speech utterance example missing "new" keyword. https://dvcs.w3.org/hg/speech-api/raw-file/tip/speechapi.html#examples-synthesis > speechSynthesis.speak(SpeechSynthesisUtterance('Hello World')); should be: > speechSynthesis.speak(new SpeechSynthesisUtterance('Hello World')); As it is currently written, it will throw a ~"constructor is not a function" error in WebKit. The working group might wish to consider if you want the constructor to return a value when called without the new keyword. For example, Date() returns a string value for the current datetime, or a Date object if prefixed with the “new" keyword. > Date() "Wed Apr 03 2013 16:40:46 GMT-0700 (PDT)" > new Date() Wed Apr 03 2013 16:40:46 GMT-0700 (PDT) > typeof Date() string > typeof new Date() object I’d lean toward making SpeechSynthesisUtteranceConstructor constructor, when called as a function, return a SpeechSynthesisUtteranceConstructor instance (effectively making the new keyword optional) but I don’t believe the current spec allows this. I may be wrong. Thanks, James Craig
Received on Wednesday, 3 April 2013 23:54:14 UTC