polyfire-js
Advanced tools
Comparing version 0.2.46 to 0.2.47
import { ReactNode } from "react"; | ||
export type BrowserSpeechOptions = Partial<SpeechSynthesisUtterance>; | ||
export type UseBrowserSpeech = { | ||
togglePlay: (content: string, speechId: string) => void; | ||
togglePlay: (content: string, speechId: string, voice?: number) => void; | ||
togglePause: () => void; | ||
@@ -12,3 +12,3 @@ speaking: boolean; | ||
export type BrowserSpeechContextType = { | ||
startSpeaking: (content: string, speechId: string) => void; | ||
startSpeaking: (content: string, speechId: string, voice?: number) => void; | ||
togglePause: () => void; | ||
@@ -15,0 +15,0 @@ speaking: boolean; |
@@ -100,3 +100,3 @@ "use strict"; | ||
}, []); | ||
var togglePlay = (0, react_1.useCallback)(function (content, speechId) { | ||
var togglePlay = (0, react_1.useCallback)(function (content, speechId, voice) { | ||
if (speaking && activeSpeechId === speechId) { | ||
@@ -109,3 +109,3 @@ stop(); | ||
else { | ||
start(content); | ||
start(content, voice); | ||
setSpeaking(true); | ||
@@ -154,7 +154,7 @@ setIsPaused(false); | ||
}, options), togglePlay = _c.togglePlay, togglePause = _c.togglePause, speaking = _c.speaking, isPaused = _c.isPaused, voices = _c.voices; | ||
var startSpeaking = function (content, speechId) { | ||
var startSpeaking = function (content, speechId, voice) { | ||
if (activeSpeechId && activeSpeechId !== speechId) { | ||
togglePlay("", activeSpeechId); | ||
togglePlay("", activeSpeechId, voice); | ||
} | ||
togglePlay(content, speechId); | ||
togglePlay(content, speechId, voice); | ||
}; | ||
@@ -161,0 +161,0 @@ return (react_1.default.createElement(BrowserSpeechContext.Provider, { value: { |
{ | ||
"name": "polyfire-js", | ||
"version": "0.2.46", | ||
"version": "0.2.47", | ||
"main": "index.js", | ||
@@ -5,0 +5,0 @@ "types": "index.d.ts", |
298791