Skip to content

Commit a90eb3b

Browse files
committed
release: 2.4.0-rc.0
1 parent b29306a commit a90eb3b

File tree

6 files changed

+45
-15
lines changed

6 files changed

+45
-15
lines changed

dist/EasySpeech.cjs.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
* @see https://developer.mozilla.org/en-US/docs/Web/API/SpeechSynthesis
2525
* @type {Object}
2626
*/
27-
var _excluded = ["text", "voice", "pitch", "rate", "volume", "force", "infiniteResume"];
27+
var _excluded = ["text", "voice", "pitch", "rate", "volume", "force", "infiniteResume", "noStop"];
2828
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); }
2929
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
3030
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."); }
@@ -693,6 +693,7 @@ var createUtterance = function createUtterance(text) {
693693
* @param {number=} options.volume - Optional volume value >= 0 and <= 1
694694
* @param {boolean=} options.force - Optional set to true to force speaking, no matter the internal state
695695
* @param {boolean=} options.infiniteResume - Optional, force or prevent internal resumeInfinity pattern
696+
* @param {boolean=} options.noStop - Optional, if true will not stop current voices
696697
* @param {object=} handlers - optional additional local handlers, can be
697698
* directly added as top-level properties of the options
698699
* @param {function=} handlers.boundary - optional, event handler
@@ -703,7 +704,6 @@ var createUtterance = function createUtterance(text) {
703704
* @param {function=} handlers.resume - optional, event handler
704705
* @param {function=} handlers.start - optional, event handler
705706
*
706-
*
707707
* @return {Promise<SpeechSynthesisEvent|SpeechSynthesisErrorEvent>}
708708
* @fulfill {SpeechSynthesisEvent} Resolves to the `end` event
709709
* @reject {SpeechSynthesisEvent} rejects using the `error` event
@@ -716,6 +716,7 @@ EasySpeech.speak = function (_ref4) {
716716
volume = _ref4.volume,
717717
force = _ref4.force,
718718
infiniteResume = _ref4.infiniteResume,
719+
noStop = _ref4.noStop,
719720
handlers = _objectWithoutProperties(_ref4, _excluded);
720721
ensureInit({
721722
force: force
@@ -828,7 +829,11 @@ EasySpeech.speak = function (_ref4) {
828829

829830
// make sure we have no mem-leak
830831
clearTimeout(timeoutResumeInfinity);
831-
internal.speechSynthesis.cancel();
832+
833+
// do not cancel currently playing voice, if noStop option is true explicitly.
834+
if (!(noStop === true)) {
835+
internal.speechSynthesis.cancel();
836+
}
832837
setTimeout(function () {
833838
return internal.speechSynthesis.speak(utterance);
834839
}, 10);

dist/EasySpeech.es5.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
var _excluded = ["text", "voice", "pitch", "rate", "volume", "force", "infiniteResume"];
1+
var _excluded = ["text", "voice", "pitch", "rate", "volume", "force", "infiniteResume", "noStop"];
22
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); }
33
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
44
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."); }
@@ -691,6 +691,7 @@ var createUtterance = function createUtterance(text) {
691691
* @param {number=} options.volume - Optional volume value >= 0 and <= 1
692692
* @param {boolean=} options.force - Optional set to true to force speaking, no matter the internal state
693693
* @param {boolean=} options.infiniteResume - Optional, force or prevent internal resumeInfinity pattern
694+
* @param {boolean=} options.noStop - Optional, if true will not stop current voices
694695
* @param {object=} handlers - optional additional local handlers, can be
695696
* directly added as top-level properties of the options
696697
* @param {function=} handlers.boundary - optional, event handler
@@ -701,7 +702,6 @@ var createUtterance = function createUtterance(text) {
701702
* @param {function=} handlers.resume - optional, event handler
702703
* @param {function=} handlers.start - optional, event handler
703704
*
704-
*
705705
* @return {Promise<SpeechSynthesisEvent|SpeechSynthesisErrorEvent>}
706706
* @fulfill {SpeechSynthesisEvent} Resolves to the `end` event
707707
* @reject {SpeechSynthesisEvent} rejects using the `error` event
@@ -714,6 +714,7 @@ EasySpeech.speak = function (_ref4) {
714714
volume = _ref4.volume,
715715
force = _ref4.force,
716716
infiniteResume = _ref4.infiniteResume,
717+
noStop = _ref4.noStop,
717718
handlers = _objectWithoutProperties(_ref4, _excluded);
718719
ensureInit({
719720
force: force
@@ -826,7 +827,11 @@ EasySpeech.speak = function (_ref4) {
826827

827828
// make sure we have no mem-leak
828829
clearTimeout(timeoutResumeInfinity);
829-
internal.speechSynthesis.cancel();
830+
831+
// do not cancel currently playing voice, if noStop option is true explicitly.
832+
if (!(noStop === true)) {
833+
internal.speechSynthesis.cancel();
834+
}
830835
setTimeout(function () {
831836
return internal.speechSynthesis.speak(utterance);
832837
}, 10);

dist/EasySpeech.iife.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ var EasySpeech = (function () {
127127
return typeof key === "symbol" ? key : String(key);
128128
}
129129

130-
var _excluded = ["text", "voice", "pitch", "rate", "volume", "force", "infiniteResume"];
130+
var _excluded = ["text", "voice", "pitch", "rate", "volume", "force", "infiniteResume", "noStop"];
131131
/**
132132
* @module EasySpeech
133133
* @typicalname EasySpeech
@@ -806,6 +806,7 @@ var EasySpeech = (function () {
806806
* @param {number=} options.volume - Optional volume value >= 0 and <= 1
807807
* @param {boolean=} options.force - Optional set to true to force speaking, no matter the internal state
808808
* @param {boolean=} options.infiniteResume - Optional, force or prevent internal resumeInfinity pattern
809+
* @param {boolean=} options.noStop - Optional, if true will not stop current voices
809810
* @param {object=} handlers - optional additional local handlers, can be
810811
* directly added as top-level properties of the options
811812
* @param {function=} handlers.boundary - optional, event handler
@@ -816,7 +817,6 @@ var EasySpeech = (function () {
816817
* @param {function=} handlers.resume - optional, event handler
817818
* @param {function=} handlers.start - optional, event handler
818819
*
819-
*
820820
* @return {Promise<SpeechSynthesisEvent|SpeechSynthesisErrorEvent>}
821821
* @fulfill {SpeechSynthesisEvent} Resolves to the `end` event
822822
* @reject {SpeechSynthesisEvent} rejects using the `error` event
@@ -829,6 +829,7 @@ var EasySpeech = (function () {
829829
volume = _ref4.volume,
830830
force = _ref4.force,
831831
infiniteResume = _ref4.infiniteResume,
832+
noStop = _ref4.noStop,
832833
handlers = _objectWithoutProperties(_ref4, _excluded);
833834
ensureInit({
834835
force: force
@@ -941,7 +942,11 @@ var EasySpeech = (function () {
941942

942943
// make sure we have no mem-leak
943944
clearTimeout(timeoutResumeInfinity);
944-
internal.speechSynthesis.cancel();
945+
946+
// do not cancel currently playing voice, if noStop option is true explicitly.
947+
if (!(noStop === true)) {
948+
internal.speechSynthesis.cancel();
949+
}
945950
setTimeout(function () {
946951
return internal.speechSynthesis.speak(utterance);
947952
}, 10);

dist/EasySpeech.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -669,6 +669,7 @@ const createUtterance = text => {
669669
* @param {number=} options.volume - Optional volume value >= 0 and <= 1
670670
* @param {boolean=} options.force - Optional set to true to force speaking, no matter the internal state
671671
* @param {boolean=} options.infiniteResume - Optional, force or prevent internal resumeInfinity pattern
672+
* @param {boolean=} options.noStop - Optional, if true will not stop current voices
672673
* @param {object=} handlers - optional additional local handlers, can be
673674
* directly added as top-level properties of the options
674675
* @param {function=} handlers.boundary - optional, event handler
@@ -679,12 +680,11 @@ const createUtterance = text => {
679680
* @param {function=} handlers.resume - optional, event handler
680681
* @param {function=} handlers.start - optional, event handler
681682
*
682-
*
683683
* @return {Promise<SpeechSynthesisEvent|SpeechSynthesisErrorEvent>}
684684
* @fulfill {SpeechSynthesisEvent} Resolves to the `end` event
685685
* @reject {SpeechSynthesisEvent} rejects using the `error` event
686686
*/
687-
EasySpeech.speak = ({ text, voice, pitch, rate, volume, force, infiniteResume, ...handlers }) => {
687+
EasySpeech.speak = ({ text, voice, pitch, rate, volume, force, infiniteResume, noStop, ...handlers }) => {
688688
ensureInit({ force });
689689

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

810810
// make sure we have no mem-leak
811811
clearTimeout(timeoutResumeInfinity);
812-
internal.speechSynthesis.cancel();
812+
813+
// do not cancel currently playing voice, if noStop option is true explicitly.
814+
if (!(noStop === true)) {
815+
internal.speechSynthesis.cancel();
816+
}
813817

814818
setTimeout(() => internal.speechSynthesis.speak(utterance), 10);
815819
})

docs/demo.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,22 @@
11
{
22
"name": "easy-speech",
3-
"version": "2.3.1",
3+
"version": "2.4.0-rc.0",
44
"description": "Cross browser Speech Synthesis",
55
"type": "module",
66
"main": "./dist/EasySpeech.cjs.js",
77
"browser": "./dist/EasySpeech.iife.js",
8-
"exports": "./dist/EasySpeech.js",
8+
"exports": {
9+
".": {
10+
"import": {
11+
"types": "./dist/index.d.ts",
12+
"default": "./dist/EasySpeech.js"
13+
},
14+
"require": {
15+
"types": "./dist/index.d.ts",
16+
"default": "./dist/EasySpeech.cjs.js"
17+
}
18+
}
19+
},
920
"types": "./dist/index.d.ts",
1021
"scripts": {
1122
"test": "NODE_ENV=test ./node_modules/.bin/mocha 'tests/**/*.tests.js'",

0 commit comments

Comments
 (0)