Updated Wrapper component, added queue for all ttp requests, updated some desktop app configuration,
This commit is contained in:
parent
e15ec4bb3f
commit
0903f96ba3
10 changed files with 207 additions and 106 deletions
|
|
@ -189,14 +189,14 @@ export default function Provider(props: {
|
|||
* Sends typed protocol messages through the active transport client.
|
||||
* @param type Protocol message type.
|
||||
* @param data Optional request payload.
|
||||
* @param options Optional request id and response mode.
|
||||
* @returns A promise for either void (no response) or typed message payload.
|
||||
* @param options Optional request id.
|
||||
* @returns A promise for the typed message payload.
|
||||
*/
|
||||
const send = useCallback<BoundSendFn<Schemas>>(
|
||||
((
|
||||
type: string,
|
||||
data?: Record<string, unknown>,
|
||||
options?: { id?: number; noResponse?: boolean },
|
||||
options?: { id?: number },
|
||||
) => {
|
||||
const client = clientRef.current;
|
||||
|
||||
|
|
@ -204,16 +204,8 @@ export default function Provider(props: {
|
|||
return Promise.reject(new Error("ttp is not connected"));
|
||||
}
|
||||
|
||||
if (options?.noResponse) {
|
||||
return client.send(type as keyof Schemas & string, data as never, {
|
||||
...options,
|
||||
noResponse: true,
|
||||
});
|
||||
}
|
||||
|
||||
return client.send(type as keyof Schemas & string, data as never, {
|
||||
...options,
|
||||
noResponse: false,
|
||||
});
|
||||
}) as BoundSendFn<Schemas>,
|
||||
[],
|
||||
|
|
|
|||
Loading…
Reference in a new issue