Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-say

Package Overview
Dependencies
Maintainers
1
Versions
52
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-say - npm Package Compare versions

Comparing version 1.0.1-master.efdec9e to 1.1.0

lib/createDeferred.js

14

CHANGELOG.md

@@ -9,4 +9,18 @@ # Changelog

## [1.1.0] - 2018-10-28
### Added
- Utterance queue are now controlled by `<Composer>` instance, instead of native `speechSynthesis` for better browser compatibility
- Chrome: does not fire `start` and `end` events if `speak`/`cancel` are called too fast
- Safari: does not play audio or `start` event if the first utterance is not triggered by user event
- Unmounting elements will cancel the speech in progress or pending speech
### Changed
- Lerna bootstrap will no longer hoist
- Playground: Bump to `react@16.6.0`, `react-dom@16.6.0`, and `react-scripts@2.0.5`
### Fixed
- Null reference on `props.speechSynthesis`
## [1.0.0] - 2018-07-09
### Added
- Initial release

332

lib/Composer.js

@@ -7,6 +7,34 @@ 'use strict';

var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _getPrototypeOf = require('babel-runtime/core-js/object/get-prototype-of');
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);
var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
var _inherits2 = require('babel-runtime/helpers/inherits');
var _inherits3 = _interopRequireDefault(_inherits2);
var _toConsumableArray2 = require('babel-runtime/helpers/toConsumableArray');
var _toConsumableArray3 = _interopRequireDefault(_toConsumableArray2);
var _regenerator = require('babel-runtime/regenerator');
var _regenerator2 = _interopRequireDefault(_regenerator);
var _asyncToGenerator2 = require('babel-runtime/helpers/asyncToGenerator');
var _asyncToGenerator3 = _interopRequireDefault(_asyncToGenerator2);
var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
var _createClass2 = require('babel-runtime/helpers/createClass');
var _createClass3 = _interopRequireDefault(_createClass2);
var _memoizeOne = require('memoize-one');

@@ -28,119 +56,180 @@

var _Utterance = require('./Utterance');
var _Utterance2 = _interopRequireDefault(_Utterance);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var SpeechContext = function () {
function SpeechContext(ponyfill) {
(0, _classCallCheck3.default)(this, SpeechContext);
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
this.queueWithCurrent = [];
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
this.cancel = this.cancel.bind(this);
this.cancelAll = this.cancelAll.bind(this);
this.speak = this.speak.bind(this);
function createContext(_ref) {
var speechSynthesis = _ref.speechSynthesis,
speechSynthesisUtterance = _ref.speechSynthesisUtterance;
this.setPonyfill(ponyfill);
}
return {
cancel: function cancel() {
return speechSynthesis.cancel();
},
speak: function speak(_ref2) {
var lang = _ref2.lang,
onBoundary = _ref2.onBoundary,
onEnd = _ref2.onEnd,
onError = _ref2.onError,
onStart = _ref2.onStart,
_ref2$pitch = _ref2.pitch,
pitch = _ref2$pitch === undefined ? 1 : _ref2$pitch,
_ref2$rate = _ref2.rate,
rate = _ref2$rate === undefined ? 1 : _ref2$rate,
text = _ref2.text,
voice = _ref2.voice,
_ref2$volume = _ref2.volume,
volume = _ref2$volume === undefined ? 1 : _ref2$volume;
(0, _createClass3.default)(SpeechContext, [{
key: 'setPonyfill',
value: function setPonyfill(_ref) {
var speechSynthesis = _ref.speechSynthesis,
SpeechSynthesisUtterance = _ref.SpeechSynthesisUtterance;
var utterance = new speechSynthesisUtterance(text);
var targetVoice = void 0;
this.ponyfill = { speechSynthesis: speechSynthesis, SpeechSynthesisUtterance: SpeechSynthesisUtterance };
}
}, {
key: 'cancel',
value: function () {
var _ref2 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee(id) {
var index;
return _regenerator2.default.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
index = this.queueWithCurrent.findIndex(function (utterance) {
return utterance.id === id;
});
if (typeof voice === 'function') {
targetVoice = voice.call(speechSynthesis, speechSynthesis.getVoices());
} else {
var _ref3 = voice || {},
voiceURI = _ref3.voiceURI;
if (!~index) {
_context.next = 3;
break;
}
targetVoice = voiceURI && [].find.call([].slice.call(speechSynthesis.getVoices()), function (v) {
return v.voiceURI === voiceURI;
});
return _context.abrupt('return', this.queueWithCurrent[index].cancel());
case 3:
case 'end':
return _context.stop();
}
}
}, _callee, this);
}));
function cancel(_x) {
return _ref2.apply(this, arguments);
}
// Edge will mute if "lang" is set to ""
utterance.lang = lang || '';
return cancel;
}()
}, {
key: 'cancelAll',
value: function () {
var _ref3 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee2() {
return _regenerator2.default.wrap(function _callee2$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
case 'end':
return _context2.stop();
}
}
}, _callee2, this);
}));
if (utterance.pitch || utterance.pitch === 0) {
utterance.pitch = pitch;
function cancelAll() {
return _ref3.apply(this, arguments);
}
if (utterance.rate || utterance.rate === 0) {
utterance.rate = rate;
return cancelAll;
}()
}, {
key: 'speak',
value: function speak(utteranceLike) {
// console.debug(`QUEUED: ${ utteranceLike.text }`);
if (utteranceLike.id && this.queueWithCurrent.find(function (_ref4) {
var id = _ref4.id;
return id === utteranceLike.id;
})) {
// Do not queue duplicated speak with same unique ID
// console.debug('NOT QUEUEING DUPE');
return;
}
// Cognitive Services will error when "voice" is set to "null"
// Edge will error when "voice" is set to "undefined"
if (targetVoice) {
utterance.voice = targetVoice;
var utterance = new _Utterance2.default(utteranceLike);
this.queueWithCurrent = [].concat((0, _toConsumableArray3.default)(this.queueWithCurrent), [utterance]);
if (this.queueWithCurrent.length === 1) {
this._next();
}
if (utterance.volume || utterance.volume === 0) {
utterance.volume = volume;
return utterance.deferred.promise;
}
}, {
key: '_next',
value: function _next() {
var _this = this;
var utterance = this.queueWithCurrent[0];
if (!utterance) {
return;
}
utterance.onboundary = onBoundary;
utterance.onend = onEnd;
utterance.onerror = onError;
utterance.onstart = onStart;
var id = utterance.id;
speechSynthesis.speak(utterance);
var promise = utterance.speak(this.ponyfill);
promise.then(function () {
_this.queueWithCurrent = _this.queueWithCurrent.filter(function (utterance) {
return utterance.id !== id;
});
_this._next();
}, function () {
// TODO: If the error is due to Safari restriction on user touch
// The next loop on the next audio will also fail because it was not queued with a user touch
_this.queueWithCurrent = _this.queueWithCurrent.filter(function (utterance) {
return utterance.id !== id;
});
_this._next();
});
}
};
}
}]);
return SpeechContext;
}();
function getVoices(speechSynthesis) {
return speechSynthesis.getVoices().map(function (_ref4) {
var def = _ref4['default'],
lang = _ref4.lang,
localService = _ref4.localService,
name = _ref4.name,
voiceURI = _ref4.voiceURI;
return {
'default': def,
lang: lang,
localService: localService,
name: name,
voiceURI: voiceURI
};
});
}
var Composer = function (_React$Component) {
_inherits(Composer, _React$Component);
(0, _inherits3.default)(Composer, _React$Component);
function Composer(props) {
_classCallCheck(this, Composer);
(0, _classCallCheck3.default)(this, Composer);
var _this = _possibleConstructorReturn(this, (Composer.__proto__ || Object.getPrototypeOf(Composer)).call(this, props));
var _this2 = (0, _possibleConstructorReturn3.default)(this, (Composer.__proto__ || (0, _getPrototypeOf2.default)(Composer)).call(this, props));
_this.handleVoicesChanged = _this.handleVoicesChanged.bind(_this);
_this2.handleVoicesChanged = _this2.handleVoicesChanged.bind(_this2);
props.speechSynthesis.onvoiceschanged = _this.handleVoicesChanged;
var voices = [];
_this.mergeContext = (0, _memoizeOne2.default)(function (context, voices) {
return _extends({}, context, { voices: voices });
if (props.speechSynthesis) {
props.speechSynthesis.addEventListener && props.speechSynthesis.addEventListener('voiceschanged', _this2.handleVoicesChanged);
voices = props.speechSynthesis.getVoices();
}
_this2.mergeContext = (0, _memoizeOne2.default)(function (_ref5, voices) {
var cancel = _ref5.cancel,
speak = _ref5.speak;
return {
cancel: cancel,
speak: speak,
voices: voices
};
});
_this.state = {
context: createContext(props),
voices: getVoices(props.speechSynthesis)
_this2.state = {
context: new SpeechContext({
speechSynthesis: props.speechSynthesis,
SpeechSynthesisUtterance: props.speechSynthesisUtterance
}),
voices: voices
};
return _this;
return _this2;
}
_createClass(Composer, [{
(0, _createClass3.default)(Composer, [{
key: 'componentWillReceiveProps',

@@ -155,16 +244,20 @@ value: function componentWillReceiveProps(nextProps) {

if (changed) {
this.props.speechSynthesis.onvoiceschanged = null;
this.state.context.cancel();
if (props.speechSynthesis) {
props.speechSynthesis.removeEventListener && props.speechSynthesis.removeEventListener('voiceschanged', this.handleVoicesChanged);
}
nextProps.speechSynthesis.onvoiceschanged = this.handleVoicesChanged;
this.state.context.setPonyfill({
speechSynthesis: nextProps.speechSynthesis,
SpeechSynthesisUtterance: nextProps.speechSynthesisUtterance
});
this.setState(function (_ref5) {
var context = _ref5.context;
var nextVoices = [];
context.cancel();
if (nextProps.speechSynthesis) {
nextProps.speechSynthesis.addEventListener && nextProps.speechSynthesis.addEventListener('voiceschanged', this.handleVoicesChanged);
nextVoices = nextProps.speechSynthesis.getVoices() || [];
}
return {
context: createContext(nextProps),
voices: getVoices(nextProps.speechSynthesis)
};
this.setState(function () {
return { voices: nextVoices };
});

@@ -174,2 +267,10 @@ }

}, {
key: 'componentWillUnmount',
value: function componentWillUnmount() {
var speechSynthesis = this.props.speechSynthesis;
speechSynthesis && speechSynthesis.removeEventListener && speechSynthesis.removeEventListener('voiceschanged', this.handleVoicesChanged);
}
}, {
key: 'handleVoicesChanged',

@@ -179,6 +280,4 @@ value: function handleVoicesChanged(_ref6) {

var voices = getVoices(target);
this.setState(function () {
return { voices: voices };
return { voices: target.getVoices() };
});

@@ -189,2 +288,4 @@ }

value: function render() {
var _this3 = this;
var props = this.props,

@@ -196,15 +297,20 @@ state = this.state;

return _react2.default.createElement(
_Context2.default.Provider,
{ value: this.mergeContext(state.context, state.voices) },
typeof children === 'function' ? _react2.default.createElement(
_Context2.default.Consumer,
null,
function (context) {
return children(context);
}
) : children
_Context2.default.Consumer,
null,
function (context) {
return context ? typeof children === 'function' ? children(context) : children : _react2.default.createElement(
_Context2.default.Provider,
{ value: _this3.mergeContext(state.context, state.voices) },
typeof children === 'function' ? _react2.default.createElement(
_Context2.default.Consumer,
null,
function (context) {
return children(context);
}
) : children
);
}
);
}
}]);
return Composer;

@@ -222,15 +328,5 @@ }(_react2.default.Component);

Composer.propTypes = {
lang: _propTypes2.default.string,
onBoundary: _propTypes2.default.func,
onEnd: _propTypes2.default.func,
onError: _propTypes2.default.func,
onStart: _propTypes2.default.func,
pitch: _propTypes2.default.number,
rate: _propTypes2.default.number,
text: _propTypes2.default.string,
voice: _propTypes2.default.oneOfType([_propTypes2.default.any, _propTypes2.default.func]),
volume: _propTypes2.default.number,
speechSynthesis: _propTypes2.default.any,
speechSynthesisUtterance: _propTypes2.default.any
};
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb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29udGV4dCA/XG4gICAgICAgICAgICB0eXBlb2YgY2hpbGRyZW4gPT09ICdmdW5jdGlvbicgPyBjaGlsZHJlbihjb250ZXh0KSA6IGNoaWxkcmVuXG4gICAgICAgICAgOlxuICAgICAgICAgICAgPENvbnRleHQuUHJvdmlkZXIgdmFsdWU9eyB0aGlzLm1lcmdlQ29udGV4dChzdGF0ZS5jb250ZXh0LCBzdGF0ZS52b2ljZXMpIH0+XG4gICAgICAgICAgICAgIHtcbiAgICAgICAgICAgICAgICB0eXBlb2YgY2hpbGRyZW4gPT09ICdmdW5jdGlvbicgP1xuICAgICAgICAgICAgICAgICAgPENvbnRleHQuQ29uc3VtZXI+XG4gICAgICAgICAgICAgICAgICAgIHsgY29udGV4dCA9PiBjaGlsZHJlbihjb250ZXh0KSB9XG4gICAgICAgICAgICAgICAgICA8L0NvbnRleHQuQ29uc3VtZXI+XG4gICAgICAgICAgICAgICAgOlxuICAgICAgICAgICAgICAgICAgY2hpbGRyZW5cbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgPC9Db250ZXh0LlByb3ZpZGVyPlxuICAgICAgICB9XG4gICAgICA8L0NvbnRleHQuQ29uc3VtZXI+XG4gICAgKTtcbiAgfVxufVxuXG5Db21wb3Nlci5kZWZhdWx0UHJvcHMgPSB7XG4gIHNwZWVjaFN5bnRoZXNpczogd2luZG93LnNwZWVjaFN5bnRoZXNpcyB8fCB3aW5kb3cud2Via2l0U3BlZWNoU3ludGhlc2lzLFxuICBzcGVlY2hTeW50aGVzaXNVdHRlcmFuY2U6IHdpbmRvdy5TcGVlY2hTeW50aGVzaXNVdHRlcmFuY2UgfHwgd2luZG93LndlYmtpdFNwZWVjaFN5bnRoZXNpc1V0dGVyYW5jZVxufTtcblxuQ29tcG9zZXIucHJvcFR5cGVzID0ge1xuICBzcGVlY2hTeW50aGVzaXM6IFByb3BUeXBlcy5hbnksXG4gIHNwZWVjaFN5bnRoZXNpc1V0dGVyYW5jZTogUHJvcFR5cGVzLmFueVxufTtcbiJdfQ==

@@ -13,11 +13,5 @@ 'use strict';

var Context = _react2.default.createContext({
cancel: function cancel() {},
getVoices: function getVoices() {
return [];
},
speak: function speak() {}
});
var Context = _react2.default.createContext();
exports.default = Context;
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9Db250ZXh0LmpzIl0sIm5hbWVzIjpbIkNvbnRleHQiLCJSZWFjdCIsImNyZWF0ZUNvbnRleHQiLCJjYW5jZWwiLCJnZXRWb2ljZXMiLCJzcGVhayJdLCJtYXBwaW5ncyI6Ijs7Ozs7O0FBQUE7Ozs7OztBQUVBLElBQU1BLFVBQVVDLGdCQUFNQyxhQUFOLENBQW9CO0FBQ2xDQyxVQUFRLGtCQUFNLENBQUUsQ0FEa0I7QUFFbENDLGFBQVc7QUFBQSxXQUFNLEVBQU47QUFBQSxHQUZ1QjtBQUdsQ0MsU0FBTyxpQkFBTSxDQUFFO0FBSG1CLENBQXBCLENBQWhCOztrQkFNZUwsTyIsImZpbGUiOiJDb250ZXh0LmpzIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IFJlYWN0IGZyb20gJ3JlYWN0JztcblxuY29uc3QgQ29udGV4dCA9IFJlYWN0LmNyZWF0ZUNvbnRleHQoe1xuICBjYW5jZWw6ICgpID0+IHt9LFxuICBnZXRWb2ljZXM6ICgpID0+IFtdLFxuICBzcGVhazogKCkgPT4ge31cbn0pO1xuXG5leHBvcnQgZGVmYXVsdCBDb250ZXh0XG4iXX0=
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9Db250ZXh0LmpzIl0sIm5hbWVzIjpbIkNvbnRleHQiLCJSZWFjdCIsImNyZWF0ZUNvbnRleHQiXSwibWFwcGluZ3MiOiI7Ozs7OztBQUFBOzs7Ozs7QUFFQSxJQUFNQSxVQUFVQyxnQkFBTUMsYUFBTixFQUFoQjs7a0JBRWVGLE8iLCJmaWxlIjoiQ29udGV4dC5qcyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBSZWFjdCBmcm9tICdyZWFjdCc7XG5cbmNvbnN0IENvbnRleHQgPSBSZWFjdC5jcmVhdGVDb250ZXh0KCk7XG5cbmV4cG9ydCBkZWZhdWx0IENvbnRleHRcbiJdfQ==

@@ -7,2 +7,34 @@ 'use strict';

var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _regenerator = require('babel-runtime/regenerator');
var _regenerator2 = _interopRequireDefault(_regenerator);
var _asyncToGenerator2 = require('babel-runtime/helpers/asyncToGenerator');
var _asyncToGenerator3 = _interopRequireDefault(_asyncToGenerator2);
var _getPrototypeOf = require('babel-runtime/core-js/object/get-prototype-of');
var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);
var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
var _createClass2 = require('babel-runtime/helpers/createClass');
var _createClass3 = _interopRequireDefault(_createClass2);
var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
var _inherits2 = require('babel-runtime/helpers/inherits');
var _inherits3 = _interopRequireDefault(_inherits2);
var _propTypes = require('prop-types');

@@ -16,37 +48,115 @@

var _Context = require('./Context');
var _Composer = require('./Composer');
var _Context2 = _interopRequireDefault(_Context);
var _Composer2 = _interopRequireDefault(_Composer);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var SayButton = function SayButton(props) {
return _react2.default.createElement(
_Context2.default.Consumer,
null,
function (context) {
var SayButton = function (_React$Component) {
(0, _inherits3.default)(SayButton, _React$Component);
function SayButton(props) {
(0, _classCallCheck3.default)(this, SayButton);
var _this = (0, _possibleConstructorReturn3.default)(this, (SayButton.__proto__ || (0, _getPrototypeOf2.default)(SayButton)).call(this, props));
_this.handleClick = _this.handleClick.bind(_this);
_this.state = {
busy: false,
id: Date.now() + Math.random()
};
return _this;
}
(0, _createClass3.default)(SayButton, [{
key: 'componentWillUnmount',
value: function componentWillUnmount() {
this.props.context.cancel(this.state.id);
}
}, {
key: 'handleClick',
value: function handleClick() {
var _this2 = this;
var props = this.props,
state = this.state;
props.onClick && props.onClick(event);
this.setState(function () {
return { busy: true };
}, (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee() {
return _regenerator2.default.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
_context.next = 2;
return props.context.speak({
id: state.id,
lang: props.lang,
onBoundary: props.onBoundary,
onEnd: props.onEnd,
onError: props.onError,
onStart: props.onStart,
pitch: props.pitch,
rate: props.rate,
text: props.speak,
voice: props.voice,
volume: props.volume
});
case 2:
_this2.setState(function () {
return {
busy: false
};
});
case 3:
case 'end':
return _context.stop();
}
}
}, _callee, _this2);
})));
}
}, {
key: 'render',
value: function render() {
var _props = this.props,
children = _props.children,
disabled = _props.disabled,
busy = this.state.busy;
return _react2.default.createElement(
'button',
{ onClick: function onClick(event) {
context.speak({
lang: props.lang,
onBoundary: props.onBoundary,
onEnd: props.onEnd,
onError: props.onError,
onStart: props.onStart,
pitch: props.pitch,
rate: props.rate,
text: props.speak,
voice: props.voice,
volume: props.volume
});
props.onClick && props.onClick(event);
} },
props.children
{
disabled: typeof disabled === 'boolean' ? disabled : busy,
onClick: this.handleClick
},
children
);
}
}]);
return SayButton;
}(_react2.default.Component);
var SayButtonWithContext = function SayButtonWithContext(props) {
return _react2.default.createElement(
_Composer2.default,
{
speechSynthesis: props.speechSynthesis,
speechSynthesisUtterance: props.speechSynthesisUtterance
},
function (context) {
return _react2.default.createElement(SayButton, (0, _extends3.default)({ context: context }, props));
}
);
};
SayButton.propTypes = {
SayButtonWithContext.propTypes = {
lang: _propTypes2.default.string,

@@ -64,3 +174,3 @@ onBoundary: _propTypes2.default.func,

exports.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LFxuICAgICAgICAgIG9uU3RhcnQ6IHByb3BzLm9uU3RhcnQsXG4gICAgICAgICAgcGl0Y2g6IHByb3BzLnBpdGNoLFxuICAgICAgICAgIHJhdGU6IHByb3BzLnJhdGUsXG4gICAgICAgICAgdGV4dDogcHJvcHMuc3BlYWssXG4gICAgICAgICAgdm9pY2U6IHByb3BzLnZvaWNlLFxuICAgICAgICAgIHZvbHVtZTogcHJvcHMudm9sdW1lXG4gICAgICAgIH0pO1xuICAgICAgICBwcm9wcy5vbkNsaWNrICYmIHByb3BzLm9uQ2xpY2soZXZlbnQpO1xuICAgICAgfSB9PlxuICAgICAgICB7IHByb3BzLmNoaWxkcmVuIH1cbiAgICAgIDwvYnV0dG9uPlxuICAgIH1cbiAgPC9Db250ZXh0LkNvbnN1bWVyPlxuXG5TYXlCdXR0b24ucHJvcFR5cGVzID0ge1xuICBsYW5nOiBQcm9wVHlwZXMuc3RyaW5nLFxuICBvbkJvdW5kYXJ5OiBQcm9wVHlwZXMuZnVuYyxcbiAgb25FbmQ6IFByb3BUeXBlcy5mdW5jLFxuICBvbkVycm9yOiBQcm9wVHlwZXMuZnVuYyxcbiAgb25TdGFydDogUHJvcFR5cGVzLmZ1bmMsXG4gIHBpdGNoOiBQcm9wVHlwZXMubnVtYmVyLFxuICByYXRlOiBQcm9wVHlwZXMubnVtYmVyLFxuICBzcGVhazogUHJvcFR5cGVzLnN0cmluZyxcbiAgdm9pY2U6IFByb3BUeXBlcy5vbmVPZlR5cGUoW1Byb3BUeXBlcy5hbnksIFByb3BUeXBlcy5mdW5jXSksXG4gIHZvbHVtZTogUHJvcFR5cGVzLm51bWJlclxufTtcblxuZXhwb3J0IGRlZmF1bHQgU2F5QnV0dG9uO1xuIl19
exports.default = SayButtonWithContext;
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9TYXlCdXR0b24uanMiXSwibmFtZXMiOlsiU2F5QnV0dG9uIiw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eXBlcyA9IHtcbiAgbGFuZzogUHJvcFR5cGVzLnN0cmluZyxcbiAgb25Cb3VuZGFyeTogUHJvcFR5cGVzLmZ1bmMsXG4gIG9uRW5kOiBQcm9wVHlwZXMuZnVuYyxcbiAgb25FcnJvcjogUHJvcFR5cGVzLmZ1bmMsXG4gIG9uU3RhcnQ6IFByb3BUeXBlcy5mdW5jLFxuICBwaXRjaDogUHJvcFR5cGVzLm51bWJlcixcbiAgcmF0ZTogUHJvcFR5cGVzLm51bWJlcixcbiAgc3BlYWs6IFByb3BUeXBlcy5zdHJpbmcsXG4gIHZvaWNlOiBQcm9wVHlwZXMub25lT2ZUeXBlKFtQcm9wVHlwZXMuYW55LCBQcm9wVHlwZXMuZnVuY10pLFxuICB2b2x1bWU6IFByb3BUeXBlcy5udW1iZXJcbn07XG5cbmV4cG9ydCBkZWZhdWx0IFNheUJ1dHRvbldpdGhDb250ZXh0XG4iXX0=

@@ -7,4 +7,34 @@ 'use strict';

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _regenerator = require('babel-runtime/regenerator');
var _regenerator2 = _interopRequireDefault(_regenerator);
var _asyncToGenerator2 = require('babel-runtime/helpers/asyncToGenerator');
var _asyncToGenerator3 = _interopRequireDefault(_asyncToGenerator2);
var _getPrototypeOf = require('babel-runtime/core-js/object/get-prototype-of');
var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);
var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
var _createClass2 = require('babel-runtime/helpers/createClass');
var _createClass3 = _interopRequireDefault(_createClass2);
var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
var _inherits2 = require('babel-runtime/helpers/inherits');
var _inherits3 = _interopRequireDefault(_inherits2);
var _propTypes = require('prop-types');

@@ -24,16 +54,10 @@

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var SayPrimitive = function (_React$Component) {
(0, _inherits3.default)(SayPrimitive, _React$Component);
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function SayPrimitive(props) {
(0, _classCallCheck3.default)(this, SayPrimitive);
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var _this = (0, _possibleConstructorReturn3.default)(this, (SayPrimitive.__proto__ || (0, _getPrototypeOf2.default)(SayPrimitive)).call(this, props));
var Say = function (_React$Component) {
_inherits(Say, _React$Component);
function Say(props) {
_classCallCheck(this, Say);
var _this = _possibleConstructorReturn(this, (Say.__proto__ || Object.getPrototypeOf(Say)).call(this, props));
_this.handleBoundary = _this.handleBoundary.bind(_this);

@@ -43,9 +67,16 @@ _this.handleEnd = _this.handleEnd.bind(_this);

_this.handleStart = _this.handleStart.bind(_this);
_this.state = { id: Date.now() + Math.random() };
return _this;
}
_createClass(Say, [{
(0, _createClass3.default)(SayPrimitive, [{
key: 'componentWillUnmount',
value: function componentWillUnmount() {
// TODO: Should dequeue self on unmount
this.unmounted = true;
this.props.context.cancel(this.state.id).catch(function (err) {
return 0;
});
}

@@ -82,39 +113,60 @@ }, {

var _props = this.props,
lang = _props.lang,
pitch = _props.pitch,
rate = _props.rate,
text = _props.speak,
voice = _props.voice,
volume = _props.volume;
(0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee() {
var _props, context, lang, pitch, rate, text, voice, volume, id;
return _regenerator2.default.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
_props = _this2.props, context = _props.context, lang = _props.lang, pitch = _props.pitch, rate = _props.rate, text = _props.speak, voice = _props.voice, volume = _props.volume;
id = _this2.state.id;
return _react2.default.createElement(
_Context2.default.Consumer,
null,
function (context) {
return context.speak({
lang: lang,
onBoundary: _this2.handleBoundary,
onEnd: _this2.handleEnd,
onError: _this2.handleError,
onStart: _this2.handleStart,
pitch: pitch,
rate: rate,
text: text,
voice: voice,
volume: volume
});
}
);
context.speak({
id: id,
lang: lang,
onBoundary: _this2.handleBoundary,
onEnd: _this2.handleEnd,
onError: _this2.handleError,
onStart: _this2.handleStart,
pitch: pitch,
rate: rate,
text: text,
voice: voice,
volume: volume
});
case 3:
case 'end':
return _context.stop();
}
}
}, _callee, _this2);
}))().catch(function (err) {
return console.error(err);
});
return false;
}
}]);
return Say;
return SayPrimitive;
}(_react2.default.Component);
exports.default = Say;
var SayPrimitiveWithContext = function SayPrimitiveWithContext(props) {
return _react2.default.createElement(
_Context2.default.Consumer,
null,
function (context) {
return _react2.default.createElement(
SayPrimitive,
(0, _extends3.default)({
context: context
}, props),
props.children
);
}
);
};
Say.propTypes = {
SayPrimitiveWithContext.propTypes = {
lang: _propTypes2.default.string,

@@ -131,2 +183,4 @@ pitch: _propTypes2.default.number,

};
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9TYXlQcmltaXRpdmUuanMiXSwibmFtZXMiOlsiU2F5IiwicHJvcHMiLCJoYW5kbGVCb3VuZGFyeSIsImJpbmQiLCJoYW5kbGVFbm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xuICAgICAgPENvbnRleHQuQ29uc3VtZXI+XG4gICAgICAgIHsgY29udGV4dCA9PiBjb250ZXh0LnNwZWFrKHtcbiAgICAgICAgICAgIGxhbmcsXG4gICAgICAgICAgICBvbkJvdW5kYXJ5OiB0aGlzLmhhbmRsZUJvdW5kYXJ5LFxuICAgICAgICAgICAgb25FbmQ6IHRoaXMuaGFuZGxlRW5kLFxuICAgICAgICAgICAgb25FcnJvcjogdGhpcy5oYW5kbGVFcnJvcixcbiAgICAgICAgICAgIG9uU3RhcnQ6IHRoaXMuaGFuZGxlU3RhcnQsXG4gICAgICAgICAgICBwaXRjaCxcbiAgICAgICAgICAgIHJhdGUsXG4gICAgICAgICAgICB0ZXh0LFxuICAgICAgICAgICAgdm9pY2UsXG4gICAgICAgICAgICB2b2x1bWVcbiAgICAgICAgICB9KVxuICAgICAgICB9XG4gICAgICA8L0NvbnRleHQuQ29uc3VtZXI+XG4gICAgKTtcbiAgfVxufVxuXG5TYXkucHJvcFR5cGVzID0ge1xuICBsYW5nOiBQcm9wVHlwZXMuc3RyaW5nLFxuICBwaXRjaDogUHJvcFR5cGVzLm51bWJlcixcbiAgcmF0ZTogUHJvcFR5cGVzLm51bWJlcixcbiAgb25Cb3VuZGFyeTogUHJvcFR5cGVzLmZ1bmMsXG4gIG9uRW5kOiBQcm9wVHlwZXMuZnVuYyxcbiAgb25FcnJvcjogUHJvcFR5cGVzLmZ1bmMsXG4gIG9uU3RhcnQ6IFByb3BUeXBlcy5mdW5jLFxuICBzcGVhazogUHJvcFR5cGVzLnN0cmluZyxcbiAgdm9pY2U6IFByb3BUeXBlcy5vbmVPZlR5cGUoW1Byb3BUeXBlcy5hbnksIFByb3BUeXBlcy5mdW5jXSksXG4gIHZvbHVtZTogUHJvcFR5cGVzLm51bWJlclxufTtcbiJdfQ==
exports.default = SayPrimitiveWithContext;
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9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gIGxhbmc6IFByb3BUeXBlcy5zdHJpbmcsXG4gIHBpdGNoOiBQcm9wVHlwZXMubnVtYmVyLFxuICByYXRlOiBQcm9wVHlwZXMubnVtYmVyLFxuICBvbkJvdW5kYXJ5OiBQcm9wVHlwZXMuZnVuYyxcbiAgb25FbmQ6IFByb3BUeXBlcy5mdW5jLFxuICBvbkVycm9yOiBQcm9wVHlwZXMuZnVuYyxcbiAgb25TdGFydDogUHJvcFR5cGVzLmZ1bmMsXG4gIHNwZWFrOiBQcm9wVHlwZXMuc3RyaW5nLFxuICB2b2ljZTogUHJvcFR5cGVzLm9uZU9mVHlwZShbUHJvcFR5cGVzLmFueSwgUHJvcFR5cGVzLmZ1bmNdKSxcbiAgdm9sdW1lOiBQcm9wVHlwZXMubnVtYmVyXG59O1xuXG5leHBvcnQgZGVmYXVsdCBTYXlQcmltaXRpdmVXaXRoQ29udGV4dFxuIl19
{
"name": "react-say",
"version": "1.0.1-master.efdec9e",
"version": "1.1.0",
"description": "A React component that synthesis text into speech using Web Speech API",

@@ -21,5 +21,6 @@ "keywords": [

"scripts": {
"bootstrap": "lerna bootstrap --hoist",
"build": "lerna run build",
"test": "lerna run test"
"bootstrap": "lerna bootstrap",
"build": "lerna run --stream build",
"test": "lerna run --stream test",
"watch": "lerna run --parallel --stream watch"
},

@@ -36,22 +37,14 @@ "author": "William Wong <compulim@hotmail.com> (http://compulim.info/)",

"homepage": "https://github.com/compulim/react-say#readme",
"devDependencies": {
"babel-cli": "^6.26.0",
"babel-core": "^6.26.3",
"babel-env": "^2.4.1",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"babel-preset-stage-3": "^6.24.1",
"jest": "^22.4.4",
"lerna": "^2.11.0",
"react": "^16.4.1",
"react-dom": "^16.4.1",
"react-scripts": "1.1.4",
"rimraf": "^2.6.2"
},
"dependencies": {
"classnames": "^2.2.6",
"glamor": "^2.20.40"
"event-as-promise": "^1.0.3",
"glamor": "^2.20.40",
"memoize-one": "^4.0.0"
},
"peerDependencies": {
"react": "^16.4.1"
},
"devDependencies": {
"lerna": "^2.11.0"
}
}

@@ -102,10 +102,15 @@ # react-say

* If `<Say>` or `<SayButton>` is unmounted, the utterance will continue to speak
* Web Speech does not support stopping or dequeueing a pending utterance, only to cancel all utterances at once
* Since the utterance is already queued, speaking, or spoken, we cannot stop it and not cancelling other "innocent" utterance
* We decided to let it continue but not firing any events after unmount
* Instead of using the native queue for utterances, we implement our own speech queue for browser compatibility reasons
* Queue is managed by `<Composer>`, all `<Say>` and `<SayButton>` inside the same `<Composer>` will share the same queue
* Native queue does not support partial cancel, when `cancel` is called, all pending utterances are stopped
* If `<Say>` or `<SayButton>` is unmounted, the utterance can be stopped without affecting other pending utterances
* Utterance order can be changed on-the-fly
* Browser quirks
* Chrome: if `cancel` and `speak` are called repeatedly, `speak` will appear to succeed (`speaking === true`) but audio is never played (`start` event is never fired)
* Safari: when speech is not triggered by user event (e.g. mouse click or tap), the speech will not be played
* Workaround: on page load, prime the speech engine by any user events
# Roadmap
* [ ] Prettify playground page
* [x] Prettify playground page

@@ -112,0 +117,0 @@ # Contributions

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc