TeaSpeak-Client/imports/shared-app/connection/AbstractCommandHandler.d.ts
2021-02-07 20:01:37 +01:00

32 lines
1.5 KiB
TypeScript

import { AbstractServerConnection, ServerCommand, SingleCommandHandler } from "../connection/ConnectionBase";
export declare abstract class AbstractCommandHandler {
readonly connection: AbstractServerConnection;
handler_boss: AbstractCommandHandlerBoss | undefined;
volatile_handler_boss: boolean;
ignore_consumed: boolean;
protected constructor(connection: AbstractServerConnection);
/**
* @return If the command should be consumed
*/
abstract handle_command(command: ServerCommand): boolean;
}
export declare type ExplicitCommandHandler = (command: ServerCommand, consumed: boolean) => void | boolean;
export declare abstract class AbstractCommandHandlerBoss {
readonly connection: AbstractServerConnection;
protected command_handlers: AbstractCommandHandler[];
protected single_command_handler: SingleCommandHandler[];
protected explicitHandlers: {
[key: string]: ExplicitCommandHandler[];
};
protected constructor(connection: AbstractServerConnection);
destroy(): void;
register_explicit_handler(command: string, callback: ExplicitCommandHandler): () => void;
unregister_explicit_handler(command: string, callback: ExplicitCommandHandler): boolean;
register_handler(handler: AbstractCommandHandler): void;
unregister_handler(handler: AbstractCommandHandler): void;
register_single_handler(handler: SingleCommandHandler): void;
remove_single_handler(handler: SingleCommandHandler): void;
handlers(): AbstractCommandHandler[];
invoke_handle(command: ServerCommand): boolean;
}