@truffle/dashboard-message-bus-client
Version:
Client library for accessing the truffle dashboard's message bus
36 lines (35 loc) • 1.25 kB
TypeScript
import { Message } from "@truffle/dashboard-message-bus-common";
import { DashboardMessageBusConnection } from "lib/connection";
interface PublishMessageLifecycleOptions {
message: Message;
connection: DashboardMessageBusConnection;
}
export declare class PublishMessageLifecycle<MessageType extends Message, ResponseType extends Message> {
/**
* The initially published message that triggered the creation of this message lifecycle.
*/
readonly message: MessageType;
/**
* The response to the message that was published, or null when that message
* has been invalidated.
*/
readonly response: Promise<ResponseType | null>;
private _connection;
private _responseReceived;
private _invalidated;
private _abandoned;
private _responsePromiseResolve;
constructor({ message, connection }: PublishMessageLifecycleOptions);
/**
* Notify other potential subscribers of this message that it has been
* invalidated, and they therefore should not respond.
*/
invalidate(): Promise<void>;
/**
* Stop waiting for the response to this message, but don't invalidate it,
* either.
*/
abandon(): Promise<void>;
private _messageHandler;
}
export {};