rxpoweredup
Version:
A Typescript RxJS-based library for controlling LEGO Powered UP hubs & peripherals.
23 lines (22 loc) • 984 B
TypeScript
import { Observable, Subject } from 'rxjs';
import { IQueueTask, ITaskVisitor } from '../queue';
import { RawMessage } from '../../../types';
import { OutboundMessageTypes } from '../../../constants';
import { IChannel } from '../i-channel';
/**
* This class represents a task that is responsible for sending a single message to the hub that is expected to receive a response.
* e.g. requesting a hub property value
*/
export declare class TaskWithResponse<TResponse> implements IQueueTask<TResponse> {
readonly message: RawMessage<OutboundMessageTypes>;
private responsesStream;
readonly result: Subject<TResponse>;
private readonly completed;
private earlyResponseCaptureSubscription?;
constructor(message: RawMessage<OutboundMessageTypes>, responsesStream: Observable<TResponse>);
discard(): void;
accept(visitor: ITaskVisitor): void;
dispose(): void;
emitError(error: Error): void;
execute(channel: IChannel): Observable<unknown>;
}