Created
May 26, 2018 22:47
-
-
Save neopunisher/a204cd1fa2b01aa7fc625b0c37c2dc6e to your computer and use it in GitHub Desktop.
control stuff with your voice in the browser
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
(function(url, inj) { | |
inj(url).then(function() { | |
if (annyang) { | |
// Let's define a command. | |
var commands = { | |
'hello': function() { alert('Hello world!'); } | |
}; | |
// Add our commands to annyang | |
annyang.addCommands(commands); | |
// Start listening. | |
annyang.start(); | |
} | |
}) | |
})('https://cdnjs.cloudflare.com/ajax/libs/annyang/2.6.0/annyang.min.js', (src, head = true) => new Promise(function(c, d) { | |
var a = document.createElement("script"); | |
a.src = src; | |
a.type = "text/javascript"; | |
a.onload = c; | |
a.onerror = d; | |
document[head ? 'head' : 'body'].appendChild(a) | |
})) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment