Skip to content

Commit

Permalink
keeping it simple
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabe authored and Gabe committed Nov 6, 2016
1 parent 8b1c109 commit dc25f46
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions documentation/coffee/async.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ sleep = (ms) ->
new Promise (resolve) ->
window.setTimeout resolve, ms

say = (text) ->
window.speechSynthesis.cancel() # cancel any prior utterances
window.speechSynthesis.speak new SpeechSynthesisUtterance text

countdown = (seconds) ->
for i in [seconds..1]
if window.speechSynthesis?
utterance = new SpeechSynthesisUtterance "#{i}"
window.speechSynthesis.cancel() # cancel any prior utterances
window.speechSynthesis.speak utterance
console.log i
say "#{i}"
await sleep 1000 # wait one second
alert "Done! (Check the console!)"
say "Blastoff!"

countdown(3)

0 comments on commit dc25f46

Please sign in to comment.