UNPKG

scriptable-testlab

Version:

A lightweight, efficient tool designed to manage and update scripts for Scriptable.

69 lines 1.25 kB
import { AbsSpeech } from "scriptable-abstract"; class MockSpeech extends AbsSpeech { static get instance() { return super.instance; } constructor() { super({ lastSpokenText: null, lastLanguage: null, lastRate: null, lastPitch: null }); } /** * @inheritdoc */ async speak(text, language, rate, pitch) { this.setState({ lastSpokenText: text, lastLanguage: language || null, lastRate: rate || null, lastPitch: pitch || null }); } /** * @additional * Get the last spoken text */ getLastSpokenText() { return this.state.lastSpokenText; } /** * @additional * Get the last used language */ getLastLanguage() { return this.state.lastLanguage; } /** * @additional * Get the last used rate */ getLastRate() { return this.state.lastRate; } /** * @additional * Get the last used pitch */ getLastPitch() { return this.state.lastPitch; } /** * @additional * Clear speech history */ clear() { this.setState({ lastSpokenText: null, lastLanguage: null, lastRate: null, lastPitch: null }); } } export { MockSpeech }; //# sourceMappingURL=speech.js.map