Skip to content

Instantly share code, notes, and snippets.

@mdobson
Last active August 29, 2015 14:07
Show Gist options
  • Save mdobson/9669ad5ba8aa05b5723e to your computer and use it in GitHub Desktop.
Save mdobson/9669ad5ba8aa05b5723e to your computer and use it in GitHub Desktop.
//somewhere else in your class
function Voice() {
this.voice = {
Agnes: {
locale: 'en_US',
example: 'Isn\'t it nice to have a computer that will talk to you?'
}
//Will return an array that looks like [{value: 'Agnes'}]
this.voiceValues = Object.keys(voices).map(function(voice){ return {value: voice}});
}
Voice.prototype.init = function(config) {
config
.map('say', this.say, [
{ name: 'words', type: 'text'},
{ name: 'voice', type: 'radio', value: this.voiceValues },
{ name: 'rate', type: 'range', min: 90, max: 720, step: 1})
}
Voice.prototype.say = function(words, voice, rate) {
voice = this.voices[voice];
//Logic here.
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment