diff --git a/src/useSpeechSynthesis.jsx b/src/useSpeechSynthesis.jsx index fbd5960..d72f5cf 100644 --- a/src/useSpeechSynthesis.jsx +++ b/src/useSpeechSynthesis.jsx @@ -58,13 +58,24 @@ const useSpeechSynthesis = (props = {}) => { setSpeaking(false); window.speechSynthesis.cancel(); }; - + const pause = () => { + if(!supported) return; + + window.speechSynthesis.pause(); + } + const resume = () => { + if(!supported) return; + window.speechSynthesis.resume(); + } return { - supported, - speak, - speaking, - cancel, - voices, + supported: supported, + speak: speak, + speaking: speaking, + cancel: cancel, + pause: pause, + resume: resume, + voices: voices + }; };