scriptable-testlab
Version:
A lightweight, efficient tool designed to manage and update scripts for Scriptable.
92 lines • 2.29 kB
JavaScript
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var speech_exports = {};
__export(speech_exports, {
MockSpeech: () => MockSpeech
});
module.exports = __toCommonJS(speech_exports);
var import_scriptable_abstract = require("scriptable-abstract");
class MockSpeech extends import_scriptable_abstract.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
});
}
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
MockSpeech
});
//# sourceMappingURL=speech.js.map