Skip to content

Instantly share code, notes, and snippets.

@fanatique
Last active January 8, 2016 10:39
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save fanatique/76f3fb8cd3910e17e54c to your computer and use it in GitHub Desktop.
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