Skip to content

Commit

Permalink
release: 2.4.0-rc.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jankapunkt committed Apr 25, 2024
1 parent b29306a commit a90eb3b
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 15 deletions.
11 changes: 8 additions & 3 deletions dist/EasySpeech.cjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
* @see https://developer.mozilla.org/en-US/docs/Web/API/SpeechSynthesis
* @type {Object}
*/
var _excluded = ["text", "voice", "pitch", "rate", "volume", "force", "infiniteResume"];
var _excluded = ["text", "voice", "pitch", "rate", "volume", "force", "infiniteResume", "noStop"];
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
Expand Down Expand Up @@ -693,6 +693,7 @@ var createUtterance = function createUtterance(text) {
* @param {number=} options.volume - Optional volume value >= 0 and <= 1
* @param {boolean=} options.force - Optional set to true to force speaking, no matter the internal state
* @param {boolean=} options.infiniteResume - Optional, force or prevent internal resumeInfinity pattern
* @param {boolean=} options.noStop - Optional, if true will not stop current voices
* @param {object=} handlers - optional additional local handlers, can be
* directly added as top-level properties of the options
* @param {function=} handlers.boundary - optional, event handler
Expand All @@ -703,7 +704,6 @@ var createUtterance = function createUtterance(text) {
* @param {function=} handlers.resume - optional, event handler
* @param {function=} handlers.start - optional, event handler
*
*
* @return {Promise<SpeechSynthesisEvent|SpeechSynthesisErrorEvent>}
* @fulfill {SpeechSynthesisEvent} Resolves to the `end` event
* @reject {SpeechSynthesisEvent} rejects using the `error` event
Expand All @@ -716,6 +716,7 @@ EasySpeech.speak = function (_ref4) {
volume = _ref4.volume,
force = _ref4.force,
infiniteResume = _ref4.infiniteResume,
noStop = _ref4.noStop,
handlers = _objectWithoutProperties(_ref4, _excluded);
ensureInit({
force: force
Expand Down Expand Up @@ -828,7 +829,11 @@ EasySpeech.speak = function (_ref4) {

// make sure we have no mem-leak
clearTimeout(timeoutResumeInfinity);
internal.speechSynthesis.cancel();

// do not cancel currently playing voice, if noStop option is true explicitly.
if (!(noStop === true)) {
internal.speechSynthesis.cancel();
}
setTimeout(function () {
return internal.speechSynthesis.speak(utterance);
}, 10);
Expand Down
11 changes: 8 additions & 3 deletions dist/EasySpeech.es5.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var _excluded = ["text", "voice", "pitch", "rate", "volume", "force", "infiniteResume"];
var _excluded = ["text", "voice", "pitch", "rate", "volume", "force", "infiniteResume", "noStop"];
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
Expand Down Expand Up @@ -691,6 +691,7 @@ var createUtterance = function createUtterance(text) {
* @param {number=} options.volume - Optional volume value >= 0 and <= 1
* @param {boolean=} options.force - Optional set to true to force speaking, no matter the internal state
* @param {boolean=} options.infiniteResume - Optional, force or prevent internal resumeInfinity pattern
* @param {boolean=} options.noStop - Optional, if true will not stop current voices
* @param {object=} handlers - optional additional local handlers, can be
* directly added as top-level properties of the options
* @param {function=} handlers.boundary - optional, event handler
Expand All @@ -701,7 +702,6 @@ var createUtterance = function createUtterance(text) {
* @param {function=} handlers.resume - optional, event handler
* @param {function=} handlers.start - optional, event handler
*
*
* @return {Promise<SpeechSynthesisEvent|SpeechSynthesisErrorEvent>}
* @fulfill {SpeechSynthesisEvent} Resolves to the `end` event
* @reject {SpeechSynthesisEvent} rejects using the `error` event
Expand All @@ -714,6 +714,7 @@ EasySpeech.speak = function (_ref4) {
volume = _ref4.volume,
force = _ref4.force,
infiniteResume = _ref4.infiniteResume,
noStop = _ref4.noStop,
handlers = _objectWithoutProperties(_ref4, _excluded);
ensureInit({
force: force
Expand Down Expand Up @@ -826,7 +827,11 @@ EasySpeech.speak = function (_ref4) {

// make sure we have no mem-leak
clearTimeout(timeoutResumeInfinity);
internal.speechSynthesis.cancel();

// do not cancel currently playing voice, if noStop option is true explicitly.
if (!(noStop === true)) {
internal.speechSynthesis.cancel();
}
setTimeout(function () {
return internal.speechSynthesis.speak(utterance);
}, 10);
Expand Down
11 changes: 8 additions & 3 deletions dist/EasySpeech.iife.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ var EasySpeech = (function () {
return typeof key === "symbol" ? key : String(key);
}

var _excluded = ["text", "voice", "pitch", "rate", "volume", "force", "infiniteResume"];
var _excluded = ["text", "voice", "pitch", "rate", "volume", "force", "infiniteResume", "noStop"];
/**
* @module EasySpeech
* @typicalname EasySpeech
Expand Down Expand Up @@ -806,6 +806,7 @@ var EasySpeech = (function () {
* @param {number=} options.volume - Optional volume value >= 0 and <= 1
* @param {boolean=} options.force - Optional set to true to force speaking, no matter the internal state
* @param {boolean=} options.infiniteResume - Optional, force or prevent internal resumeInfinity pattern
* @param {boolean=} options.noStop - Optional, if true will not stop current voices
* @param {object=} handlers - optional additional local handlers, can be
* directly added as top-level properties of the options
* @param {function=} handlers.boundary - optional, event handler
Expand All @@ -816,7 +817,6 @@ var EasySpeech = (function () {
* @param {function=} handlers.resume - optional, event handler
* @param {function=} handlers.start - optional, event handler
*
*
* @return {Promise<SpeechSynthesisEvent|SpeechSynthesisErrorEvent>}
* @fulfill {SpeechSynthesisEvent} Resolves to the `end` event
* @reject {SpeechSynthesisEvent} rejects using the `error` event
Expand All @@ -829,6 +829,7 @@ var EasySpeech = (function () {
volume = _ref4.volume,
force = _ref4.force,
infiniteResume = _ref4.infiniteResume,
noStop = _ref4.noStop,
handlers = _objectWithoutProperties(_ref4, _excluded);
ensureInit({
force: force
Expand Down Expand Up @@ -941,7 +942,11 @@ var EasySpeech = (function () {

// make sure we have no mem-leak
clearTimeout(timeoutResumeInfinity);
internal.speechSynthesis.cancel();

// do not cancel currently playing voice, if noStop option is true explicitly.
if (!(noStop === true)) {
internal.speechSynthesis.cancel();
}
setTimeout(function () {
return internal.speechSynthesis.speak(utterance);
}, 10);
Expand Down
10 changes: 7 additions & 3 deletions dist/EasySpeech.js
Original file line number Diff line number Diff line change
Expand Up @@ -669,6 +669,7 @@ const createUtterance = text => {
* @param {number=} options.volume - Optional volume value >= 0 and <= 1
* @param {boolean=} options.force - Optional set to true to force speaking, no matter the internal state
* @param {boolean=} options.infiniteResume - Optional, force or prevent internal resumeInfinity pattern
* @param {boolean=} options.noStop - Optional, if true will not stop current voices
* @param {object=} handlers - optional additional local handlers, can be
* directly added as top-level properties of the options
* @param {function=} handlers.boundary - optional, event handler
Expand All @@ -679,12 +680,11 @@ const createUtterance = text => {
* @param {function=} handlers.resume - optional, event handler
* @param {function=} handlers.start - optional, event handler
*
*
* @return {Promise<SpeechSynthesisEvent|SpeechSynthesisErrorEvent>}
* @fulfill {SpeechSynthesisEvent} Resolves to the `end` event
* @reject {SpeechSynthesisEvent} rejects using the `error` event
*/
EasySpeech.speak = ({ text, voice, pitch, rate, volume, force, infiniteResume, ...handlers }) => {
EasySpeech.speak = ({ text, voice, pitch, rate, volume, force, infiniteResume, noStop, ...handlers }) => {
ensureInit({ force });

if (!validate.text(text)) {
Expand Down Expand Up @@ -809,7 +809,11 @@ EasySpeech.speak = ({ text, voice, pitch, rate, volume, force, infiniteResume, .

// make sure we have no mem-leak
clearTimeout(timeoutResumeInfinity);
internal.speechSynthesis.cancel();

// do not cancel currently playing voice, if noStop option is true explicitly.
if (!(noStop === true)) {
internal.speechSynthesis.cancel();
}

setTimeout(() => internal.speechSynthesis.speak(utterance), 10);
})
Expand Down
2 changes: 1 addition & 1 deletion docs/demo.js

Large diffs are not rendered by default.

15 changes: 13 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,22 @@
{
"name": "easy-speech",
"version": "2.3.1",
"version": "2.4.0-rc.0",
"description": "Cross browser Speech Synthesis",
"type": "module",
"main": "./dist/EasySpeech.cjs.js",
"browser": "./dist/EasySpeech.iife.js",
"exports": "./dist/EasySpeech.js",
"exports": {
".": {
"import": {
"types": "./dist/index.d.ts",
"default": "./dist/EasySpeech.js"
},
"require": {
"types": "./dist/index.d.ts",
"default": "./dist/EasySpeech.cjs.js"
}
}
},
"types": "./dist/index.d.ts",
"scripts": {
"test": "NODE_ENV=test ./node_modules/.bin/mocha 'tests/**/*.tests.js'",
Expand Down

0 comments on commit a90eb3b

Please sign in to comment.