@speechly/react-client
Advanced tools
Comparing version 0.0.6 to 0.0.7
@@ -87,2 +87,3 @@ import React from 'react'; | ||
recordingState: SpeechState; | ||
toggleIsOn: boolean; | ||
segment?: SpeechSegment; | ||
@@ -109,2 +110,4 @@ tentativeTranscript?: TentativeSpeechTranscript; | ||
readonly initialiseAudio: () => Promise<void>; | ||
readonly startContext: () => Promise<void>; | ||
readonly stopContext: () => Promise<void>; | ||
readonly toggleRecording: () => Promise<void>; | ||
@@ -111,0 +114,0 @@ render(): JSX.Element; |
@@ -102,3 +102,3 @@ "use strict"; | ||
}); }; | ||
_this.toggleRecording = function () { return __awaiter(_this, void 0, void 0, function () { | ||
_this.startContext = function () { return __awaiter(_this, void 0, void 0, function () { | ||
var _a, client, clientState, _b; | ||
@@ -113,5 +113,4 @@ return __generator(this, function (_c) { | ||
case browser_client_1.ClientState.Connected: return [3 /*break*/, 4]; | ||
case browser_client_1.ClientState.Recording: return [3 /*break*/, 6]; | ||
} | ||
return [3 /*break*/, 8]; | ||
return [3 /*break*/, 6]; | ||
case 1: return [4 /*yield*/, client.initialize()]; | ||
@@ -128,10 +127,46 @@ case 2: | ||
return [2 /*return*/]; | ||
case 6: return [4 /*yield*/, client.stopContext()]; | ||
case 7: | ||
case 6: throw Error('Cannot start context - client is not connected'); | ||
} | ||
}); | ||
}); }; | ||
_this.stopContext = function () { return __awaiter(_this, void 0, void 0, function () { | ||
var _a, client, clientState, _b; | ||
return __generator(this, function (_c) { | ||
switch (_c.label) { | ||
case 0: | ||
_a = this.state, client = _a.client, clientState = _a.clientState; | ||
_b = clientState; | ||
switch (_b) { | ||
case browser_client_1.ClientState.Starting: return [3 /*break*/, 1]; | ||
case browser_client_1.ClientState.Connected: return [3 /*break*/, 3]; | ||
case browser_client_1.ClientState.Recording: return [3 /*break*/, 5]; | ||
} | ||
return [3 /*break*/, 7]; | ||
case 1: return [4 /*yield*/, client.stopContext()]; | ||
case 2: | ||
_c.sent(); | ||
return [2 /*return*/]; | ||
case 8: return [2 /*return*/, Promise.resolve()]; | ||
case 3: return [4 /*yield*/, client.stopContext()]; | ||
case 4: | ||
_c.sent(); | ||
return [2 /*return*/]; | ||
case 5: return [4 /*yield*/, client.stopContext()]; | ||
case 6: | ||
_c.sent(); | ||
return [2 /*return*/]; | ||
case 7: return [2 /*return*/, Promise.resolve()]; | ||
} | ||
}); | ||
}); }; | ||
_this.toggleRecording = function () { return __awaiter(_this, void 0, void 0, function () { | ||
var toggleIsOn; | ||
return __generator(this, function (_a) { | ||
toggleIsOn = this.state.toggleIsOn; | ||
this.setState({ toggleIsOn: !toggleIsOn }); | ||
if (!toggleIsOn) { | ||
return [2 /*return*/, this.startContext()]; | ||
} | ||
return [2 /*return*/, this.stopContext()]; | ||
}); | ||
}); }; | ||
_this.initialiseClient = function (opts) { | ||
@@ -230,2 +265,3 @@ var _a; | ||
clientState: browser_client_1.ClientState.Disconnected, | ||
toggleIsOn: false, | ||
}; | ||
@@ -232,0 +268,0 @@ return _this; |
@@ -117,2 +117,4 @@ import { Client } from '@speechly/browser-client'; | ||
readonly initialiseAudio: () => Promise<void>; | ||
readonly startContext: () => Promise<void>; | ||
readonly stopContext: () => Promise<void>; | ||
readonly toggleRecording: () => Promise<void>; | ||
@@ -148,2 +150,3 @@ render(): JSX.Element; | ||
recordingState: SpeechState; | ||
toggleIsOn: boolean; | ||
segment?: SpeechSegment; | ||
@@ -150,0 +153,0 @@ tentativeTranscript?: TentativeSpeechTranscript; |
{ | ||
"name": "@speechly/react-client", | ||
"version": "0.0.6", | ||
"version": "0.0.7", | ||
"description": "React client for Speechly SLU API", | ||
@@ -39,3 +39,3 @@ "private": false, | ||
"dependencies": { | ||
"@speechly/browser-client": "^1.0.4" | ||
"@speechly/browser-client": "^1.0.5" | ||
}, | ||
@@ -64,3 +64,3 @@ "peerDependencies": { | ||
"typedoc-plugin-markdown": "^3.0.7", | ||
"typescript": "^4.0.3" | ||
"typescript": "4.1.5" | ||
}, | ||
@@ -67,0 +67,0 @@ "publishConfig": { |
@@ -8,5 +8,5 @@ // This file is read by tools that parse documentation comments conforming to the TSDoc standard. | ||
"packageName": "@microsoft/api-extractor", | ||
"packageVersion": "7.10.4" | ||
"packageVersion": "7.13.2" | ||
} | ||
] | ||
} |
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
50464
923