The Text to Speech module contains an interface to the DOM or Cordova text-to-speech functions. WebApps will use the DOM, while native Cordova apps will use the Android or iOS native text-to-speech interface.
speechimport {speech} from 'common/option/speech.js';
The speech object contains methods for the DOM text-to-speech functions.
speech methodsspeech.isSpeak()ctxDraw.isSpeak()
Returns true if text-to-speech is available.
A Boolean.
speech.speak()ctxDraw.speak(text)
ctxDraw.speak(text, options)
Speaks the text on the device. The options argument can change the speech rate. The method returns a Promise that resolves when the speech is completed. It's up to the caller add delay between speech or to ensure that the next speach is queued only after current speach completes.
textoptionsA Promise that resolves or rejects when the speech is complete.