1
0
Fork 0
mirror of https://github.com/jashkenas/coffeescript.git synced 2022-11-09 12:23:24 -05:00

eliminate utterance queuing

This commit is contained in:
Gabe 2016-11-06 02:40:24 -08:00
parent ea3f044816
commit 8b1c109b9c

View file

@ -6,6 +6,7 @@ countdown = (seconds) ->
for i in [seconds..1] for i in [seconds..1]
if window.speechSynthesis? if window.speechSynthesis?
utterance = new SpeechSynthesisUtterance "#{i}" utterance = new SpeechSynthesisUtterance "#{i}"
window.speechSynthesis.cancel() # cancel any prior utterances
window.speechSynthesis.speak utterance window.speechSynthesis.speak utterance
console.log i console.log i
await sleep 1000 # wait one second await sleep 1000 # wait one second