📄 useSpeechSynthesis/demo¶
📊 Analysis Summary¶
| Metric | Count |
|---|---|
| 🔧 Functions | 5 |
| 📦 Imports | 6 |
| 📊 Variables & Constants | 3 |
| 🟢 Vue Composition API | 2 |
📚 Table of Contents¶
🛠️ File Location:¶
📂 packages/core/useSpeechSynthesis/demo.vue
📦 Imports¶
| Name | Source |
|---|---|
useSpeechSynthesis |
@vueuse/core |
computed |
vue |
deepRef |
vue |
onMounted |
vue |
shallowRef |
vue |
watch |
vue |
Variables & Constants¶
| Name | Type | Kind | Value | Exported |
|---|---|---|---|---|
voice |
boolean |
let/var | deepRef<SpeechSynthesisVoice>(undefined as unknown as SpeechSynthesisVoice) |
✗ |
synth |
SpeechSynthesis |
let/var | *not shown* |
✗ |
voices |
boolean |
let/var | shallowRef<SpeechSynthesisVoice[]>([]) |
✗ |
Vue Composition API¶
| Name | Type | Reactive Variables | Composables |
|---|---|---|---|
computed |
computed | none | none |
watch |
watch | none | none |
Functions¶
onBoundary(event: SpeechSynthesisEvent): void¶
Parameters:
eventSpeechSynthesisEvent
Returns: void
Calls:
fullText.sliceremainingText.match
Code
function onBoundary(event: SpeechSynthesisEvent) {
const { charIndex, charLength } = event
const startIndex = charIndex
let endIndex = charIndex
if (typeof charLength === 'number' && charLength > 0) {
endIndex = startIndex + charLength
}
else {
const fullText = text.value || ''
const remainingText = fullText.slice(startIndex)
const firstWordMatch = remainingText.match(/^\S+/)
endIndex = startIndex + (firstWordMatch ? firstWordMatch[0].length : 0)
}
boundaryStart.value = startIndex
boundaryEnd.value = endIndex
}
resetSpeakingText(): void¶
Returns: void
play(): void¶
Returns: void
Calls:
window.speechSynthesis.resumeresetSpeakingTextspeech.speak
Code
pause(): void¶
Returns: void
Calls:
window.speechSynthesis.pause
stop(): void¶
Returns: void
Calls:
speech.stopresetSpeakingText
Generated by Syntax Scribe