@speechly/browser-client
Advanced tools
Comparing version 1.0.5 to 1.0.6
@@ -126,2 +126,3 @@ | ||
startContext(): Promise<string>; | ||
private _startContext; | ||
/** | ||
@@ -128,0 +129,0 @@ * Stops current SLU context by sending a stop context event to the API and muting the microphone |
{ | ||
"name": "@speechly/browser-client", | ||
"version": "1.0.5", | ||
"version": "1.0.6", | ||
"description": "Browser client for Speechly API", | ||
@@ -5,0 +5,0 @@ "private": false, |
@@ -70,2 +70,5 @@ <h1 align="center"> | ||
### Client states | ||
<img width="246" height="506" src="https://raw.githubusercontent.com/speechly/android-repo-filtering/master/assets/states.jpeg" /> | ||
## Contributing | ||
@@ -72,0 +75,0 @@ |
@@ -56,2 +56,3 @@ import { ClientOptions, StateChangeCallback, SegmentChangeCallback, TentativeTranscriptCallback, TranscriptCallback, TentativeEntitiesCallback, EntityCallback, IntentCallback } from './types'; | ||
startContext(): Promise<string>; | ||
private _startContext; | ||
/** | ||
@@ -58,0 +59,0 @@ * Stops current SLU context by sending a stop context event to the API and muting the microphone |
@@ -298,6 +298,12 @@ "use strict"; | ||
} | ||
if (this.state !== types_1.ClientState.Connected) { | ||
if (this.state === types_1.ClientState.Disconnected) { | ||
throw Error('Cannot start context - client is not connected'); | ||
} | ||
this.setState(types_1.ClientState.Starting); | ||
const contextId = yield this._startContext(); | ||
return contextId; | ||
}); | ||
} | ||
_startContext() { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
let contextId; | ||
@@ -323,3 +329,3 @@ try { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
if (this.state !== types_1.ClientState.Recording) { | ||
if (this.state !== types_1.ClientState.Recording && this.state !== types_1.ClientState.Starting) { | ||
throw Error('Cannot stop context - client is not recording'); | ||
@@ -326,0 +332,0 @@ } |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
164930
3004
93