daily pastebin goal
69%
SHARE
TWEET

Untitled

a guest Sep 14th, 2018 53 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. private setupListener(selectedLanguage: string): void {
  2.     this._speech.lang = selectedLanguage; //'en-US' 'pt-BR' 'it-IT'
  3.     this._speech.interimResults = false; // We don't want partial results
  4.     this._speech.maxAlternatives = 1; // By now we are interested only on the most accurate alternative
  5.  
  6.     if (!this._speech.onstart) {
  7.       this._speech.onspeechstart = (event) => { this.handleSpeechStart(event) };
  8.     }
  9.  
  10.     if (!this._speech.onresult) {
  11.       // VERY IMPORTANT: To preserve the lexical scoping of 'this' across closures in TypeScript, you use Arrow Function Expressions
  12.       this._speech.onresult = (event) => { this.handleResultevent(event) };
  13.     }
  14.  
  15.     if (!this._speech.onend) {
  16.       // VERY IMPORTANT: To preserve the lexical scoping of 'this' across closures in TypeScript, you use Arrow Function Expressions
  17.       this._speech.onend = (event) => { this.handleEndEvent(event) };
  18.     }
  19.  
  20.     if (!this._speech.onspeechend) {
  21.       // VERY IMPORTANT: To preserve the lexical scoping of 'this' across closures in TypeScript, you use Arrow Function Expressions
  22.       this._speech.onspeechend = (event) => { this.handleSpeechEndEvent(event) };
  23.     }
  24.  
  25.     if (!this._speech.nomatch) {
  26.       // VERY IMPORTANT: To preserve the lexical scoping of 'this' across closures in TypeScript, you use Arrow Function Expressions
  27.       this._speech.nomatch = (event) => { this.handleNoRecognitionAvaliable(event) };
  28.     }
  29.  
  30.   }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top