@kayahr/ed-journal
Version:
Typescript library to read/watch the player journal of Frontier's game Elite Dangerous
33 lines (32 loc) • 1 kB
TypeScript
/**
* Allows async process to be notified by another process.
*/
export declare class Notifier {
private error;
private promise;
private resolve;
private reject;
/**
* Creates a new notifier.
*
* @param signal - Optional abort signal to connect to. When signal reports an abort then the notifier is notified.
*/
constructor(signal?: AbortSignal);
/**
* Notifies waiting processes. This resolves the promise returned by {@link wait} method.
*/
notify(): void;
/**
* Aborts the notifier. This rejects the promise returned by the {@link wait} method.
*
* @param error - The error with which to abort the notifier.
*/
abort(error: Error): void;
private reset;
/**
* Waits until some other process calls the {@link notify} or {@link abort} method.
*
* @returns Promise resolved with {@link notify} was called or rejected when {@link abort} has been called.
*/
wait(): Promise<void>;
}