Instantly share code, notes, and snippets.

Embed
What would you like to do?
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