Last active
January 8, 2016 10:39
-
-
Save fanatique/76f3fb8cd3910e17e54c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var UI = require('ui'); | |
var Voice = require('ui/voice'); | |
var ajax = require('ajax'); | |
var main = new UI.Window({ | |
fullscreen: true | |
}); | |
main.on('show', function(e) { | |
Voice.dictate('start', true, function(e) { | |
if (e.err) { | |
console.log('Error: ' + e.err); | |
return; | |
} | |
ajax({ | |
url: 'http://echo.jsontest.com/message/'+encode(e.transcription), | |
method: 'GET', | |
type: undefined, | |
headers: { | |
} | |
}, | |
function(data, status, request) { | |
console.log('Awesome! Your message has been posted.'); | |
}, | |
function(error, status, request) { | |
console.log('There was an error posting your message.'); | |
} | |
); | |
}); | |
}); | |
main.show(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment