data-channel-router
Version:
Data channel router
31 lines (30 loc) • 1.17 kB
TypeScript
import { ThreadEvents } from "../enums";
import { IThreadOptions } from "../interfaces";
import { Id } from "../types";
import { EventEmitter } from "../utils";
type Events = typeof ThreadEvents.STARTED | typeof ThreadEvents.REJECTED | typeof ThreadEvents.WAIT_FOR_CONNECTION | typeof ThreadEvents.COMPLITED;
type OnStartedListener = (thread: Thread) => void;
type OnRejectedListener = (thread: Thread) => void;
type OnWaitForConnectionListener = (thread: Thread) => void;
type OnComplitedListener = (thread: Thread) => void;
type Listeners = OnStartedListener | OnRejectedListener | OnWaitForConnectionListener | OnComplitedListener;
/**
* Thread
* @link https://github.com/DjonnyX/data-channel-router/blob/main/library/src/components/Thread.ts
* @author Evgenii Grebennikov
* @email djonnyx@gmail.com
*/
export declare class Thread extends EventEmitter<Events, Listeners> {
private static __nextId;
private _id;
get id(): Id;
private _onStart;
set onStart(v: () => void);
constructor(options?: IThreadOptions);
start(): void;
reject(): void;
waitForConnect(): void;
complete(): void;
dispose(): void;
}
export {};