Skip to content

Instantly share code, notes, and snippets.

@nderscore
Created October 7, 2016 20:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nderscore/6a1e8e52dcf062aca305ba1e83f3c2da to your computer and use it in GitHub Desktop.
Save nderscore/6a1e8e52dcf062aca305ba1e83f3c2da to your computer and use it in GitHub Desktop.
if (window.speechSynthesis && console.log.name !== 'talkLog') {
console.log = (log => function talkLog(){
[...arguments].forEach(item => {
if (typeof item !== 'string') {
try {
item = `Object: ${JSON.stringify(item)}`;
} catch (e) {
item = '';
}
}
speechSynthesis.speak(new SpeechSynthesisUtterance(item));
});
return log.apply(this, arguments);
})(console.log);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment