Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adopt event-target-shim #72

Merged
merged 4 commits into from
Sep 14, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Quirks: in continuous mode, calling `stop` in-between `recognizing` and `recognized` will not emit final `result` event
- Speech recognition: New `audioConfig` option to override the default `AudioConfig.fromDefaultMicrophoneInput`, in PR [#33](https://github.com/compulim/web-speech-cognitive-services/pull/33)
- Speech synthesis: Fix [#32](https://github.com/compulim/web-speech-cognitive-services/issues/32), fetch voices from services, in PR [#35](https://github.com/compulim/web-speech-cognitive-services/pull/35)
- Speech synthesis: Fix [#34](https://github.com/compulim/web-speech-cognitive-services/issues/34), in PR [#36](https://github.com/compulim/web-speech-cognitive-services/pull/36) and PR [#XXX](https://github.com/compulim/web-speech-cognitive-services/pull/XXX)
- Speech synthesis: Fix [#34](https://github.com/compulim/web-speech-cognitive-services/issues/34), in PR [#36](https://github.com/compulim/web-speech-cognitive-services/pull/36) and PR [#44](https://github.com/compulim/web-speech-cognitive-services/pull/44)
- Support user-controlled `AudioContext` object to be passed as an option named `audioContext`
- If no `audioContext` option is passed, will create a new `AudioContext` object on first synthesis
- Speech synthesis: If an empty utterance is being synthesized, will play an local empty audio clip, in PR [#36](https://github.com/compulim/web-speech-cognitive-services/pull/36)
Expand Down Expand Up @@ -60,6 +60,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Added bundle distribution thru https://unpkg.com/web-speech-cognitive-services@latest/umd/, in PR [#21](https://github.com/compulim/web-speech-cognitive-services/pull/21)
- Bumped to [[email protected]](https://www.npmjs.com/package/microsoft-cognitiveservices-speech-sdk), in PR [#22](https://github.com/compulim/web-speech-cognitive-services/pull/22)
- Fix [#55](https://github.com/compulim/web-speech-cognitive-services/issues/55) and [#63](https://github.com/compulim/web-speech-cognitive-services/issues/63). Moves to [WHATWG `EventTarget` interface](https://dom.spec.whatwg.org/#interface-eventtarget), in PR [#56](https://github.com/compulim/web-speech-cognitive-services/pulls/56) and PR [#64](https://github.com/compulim/web-speech-cognitive-services/pulls/64)
- Instead of including `[email protected]`, we are adopting its source code, in PR [#72](https://github.com/compulim/web-speech-cognitive-services/pulls/72)
- This is because the original package requires browser to support rest/spread operators

### Fixed

Expand Down
6 changes: 3 additions & 3 deletions packages/bundle/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions packages/component/.eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/**/*.spec.js
/**/*.test.js
/src/BingSpeech/**/*
/src/external/**/*
6 changes: 3 additions & 3 deletions packages/component/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
/* eslint no-empty-function: "off" */
/* eslint no-magic-numbers: ["error", { "ignore": [0, 100, 150] }] */

import { defineEventAttribute, EventTarget } from 'event-target-shim';
import { defineEventAttribute, EventTarget } from '../../external/event-target-shim';

import cognitiveServiceEventResultToWebSpeechRecognitionResultList from './cognitiveServiceEventResultToWebSpeechRecognitionResultList';
import createPromiseQueue from '../../Util/createPromiseQueue';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
/* eslint no-empty: ["error", { "allowEmptyCatch": true }] */

import { defineEventAttribute, EventTarget } from 'event-target-shim';
import { defineEventAttribute, EventTarget } from '../../external/event-target-shim';
import EventAsPromise from 'event-as-promise';

import fetchSpeechData from './fetchSpeechData';
import SpeechSynthesisEvent from './SpeechSynthesisEvent';
import SpeechSynthesisVoice from './SpeechSynthesisVoice';
import subscribeEvent from './subscribeEvent';

function asyncDecodeAudioData(audioContext, arrayBuffer) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { defineEventAttribute, EventTarget } from 'event-target-shim';
/* eslint class-methods-use-this: 0 */

import { defineEventAttribute, EventTarget } from '../../external/event-target-shim';
import memoize from 'memoize-one';
import onErrorResumeNext from 'on-error-resume-next';

Expand Down Expand Up @@ -46,20 +48,18 @@ export default ({
)
);

const getAuthorizationToken = async () => {
return (
typeof authorizationToken === 'function' ?
await authorizationToken()
: authorizationToken ?
await authorizationToken
:
await fetchMemoizedAuthorizationToken({
now: Date.now,
region,
subscriptionKey
})
);
};
const getAuthorizationToken = () => (
typeof authorizationToken === 'function' ?
authorizationToken()
: authorizationToken ?
authorizationToken
:
fetchMemoizedAuthorizationToken({
now: Date.now,
region,
subscriptionKey
})
);

class SpeechSynthesis extends EventTarget {
constructor() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ async function fetchEndpoint({ deploymentId, region, subscriptionKey }) {
throw new Error('Failed to fetch custom voices');
}

return await res.json();
return res.json();
}

export default async function ({ deploymentId, region, subscriptionKey }) {
Expand Down
Loading