Relocate example per new folder structure; update per final notes

This commit is contained in:
Geoffrey Booth 2016-11-22 21:53:03 -08:00
parent bc471da960
commit ceca091816
2 changed files with 6 additions and 26 deletions

View File

@ -1,15 +1,18 @@
# Your browser must support async/await and speech synthesis
# to run this example.
sleep = (ms) ->
new Promise (resolve) ->
window.setTimeout resolve, ms
say = (text) ->
window.speechSynthesis.cancel() # cancel any prior utterances
window.speechSynthesis.cancel()
window.speechSynthesis.speak new SpeechSynthesisUtterance text
countdown = (seconds) ->
for i in [seconds..1]
say "#{i}"
say i
await sleep 1000 # wait one second
say "Blastoff!"
countdown(3)
countdown 3

View File

@ -1,23 +0,0 @@
// Generated by CoffeeScript 2.0.0-alpha
var countdown, sleep;
sleep = function(ms) {
return new Promise(function(resolve) {
return window.setTimeout(resolve, ms);
});
};
countdown = async function(seconds) {
var i, j, ref, utterance;
for (i = j = ref = seconds; ref <= 1 ? j <= 1 : j >= 1; i = ref <= 1 ? ++j : --j) {
if (window.speechSynthesis != null) {
utterance = new SpeechSynthesisUtterance("" + i);
window.speechSynthesis.speak(utterance);
}
console.log(i);
await sleep(1000);
}
return alert("Done! (Check the console!)");
};
countdown(3);