Skip to content

Instantly share code, notes, and snippets.

@tomhodgins
Last active November 12, 2019 19:30
Show Gist options
  • Save tomhodgins/71bd6ae8bf1219448cba414891257163 to your computer and use it in GitHub Desktop.
Save tomhodgins/71bd6ae8bf1219448cba414891257163 to your computer and use it in GitHub Desktop.
window.console = {
original: console,
...console,
speak: (strings, func, start) => strings.forEach(string => {
speechSynthesis.speak(new SpeechSynthesisUtterance((start ? start : '') + string))
return console.original[func](string)
}),
log: (...strings) => console.speak(strings, 'log', `Dear diary. `),
info: (...strings) => console.speak(strings, 'info', `For your information. `),
warn: (...strings) => console.speak(strings, 'warn', `I'm warning you. `),
error: (...strings) => console.speak(strings, 'error', `Red alert. `)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment