Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
// Browser based version of npm speak
function sayIt({ action, context }) {
const { text } = action.payload;
const { speechSynthesis, SpeechSynthesisUtterance } = context;
return new Observable(notify => {
var msg = new SpeechSynthesisUtterance();
msg.onend = function (e) {
notify.complete();
}
speechSynthesis.speak(msg);
return () => speechSynthesis.cancel();
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.