Options
All
  • Public
  • Public/Protected
  • All
Menu

Class BaseClient

Hierarchy

Index

Type aliases

Static ArgumentMap

ArgumentMap<T>: {}

Type parameters

  • T: object

Type declaration

Static EventArgs

EventArgs<T, K>: Parameters<EventListener<T, K>>

Type parameters

Static EventListener

EventListener<T, K>: T extends string | symbol ? (...args: any[]) => void : (...args: ArgumentMap<Exclude<T, string | symbol>>[Extract<K, keyof T>]) => void

Type parameters

Static EventNames

EventNames<T>: T extends string | symbol ? T : keyof T

Type parameters

Static ValidEventTypes

ValidEventTypes: string | symbol | object

object should be in either of the following forms:

interface EventTypes {
  'event-with-parameters': any[]
  'event-with-example-handler': (...args: any[]) => void
}

Properties

Readonly configuration

Readonly Abstract joinedChannels

joinedChannels: Set<string>

state

state: ClientState = ClientState.UNCONNECTED

Readonly Abstract wantedChannels

wantedChannels: Set<string>

Static EventEmitter

EventEmitter: EventEmitterStatic

Static prefixed

prefixed: string | boolean

Accessors

closed

  • get closed(): boolean

connected

  • get connected(): boolean

connecting

  • get connecting(): boolean

ready

  • get ready(): boolean

unconnected

  • get unconnected(): boolean

Methods

addListener

  • addListener<T>(event: T, fn: EventEmitter.EventListener<ClientEvents, T>, context?: Context): this

advanceState

emit

  • emit<T>(event: T, ...args: EventEmitter.EventArgs<ClientEvents, T>): boolean
  • Calls each of the listeners registered for a given event.

    Type parameters

    Parameters

    • event: T
    • Rest ...args: EventEmitter.EventArgs<ClientEvents, T>

    Returns boolean

emitClosed

  • emitClosed(error?: Error): void

emitConnected

  • emitConnected(): void

emitConnecting

  • emitConnecting(): void

emitError

  • emitError(error: Error, emitEvenIfClosed?: boolean): void

emitMessage

emitReady

  • emitReady(): void

eventNames

  • Return an array listing the events for which the emitter has registered listeners.

    Returns Array<EventEmitter.EventNames<ClientEvents>>

listenerCount

  • listenerCount(event: EventEmitter.EventNames<ClientEvents>): number
  • Return the number of listeners listening to a given event.

    Parameters

    Returns number

listeners

  • Return the listeners registered for a given event.

    Type parameters

    Parameters

    • event: T

    Returns Array<EventEmitter.EventListener<ClientEvents, T>>

off

  • off<T>(event: T, fn?: EventEmitter.EventListener<ClientEvents, T>, context?: Context, once?: undefined | false | true): this
  • Type parameters

    Parameters

    • event: T
    • Optional fn: EventEmitter.EventListener<ClientEvents, T>
    • Optional context: Context
    • Optional once: undefined | false | true

    Returns this

on

  • Add a listener for a given event.

    Type parameters

    Parameters

    Returns this

once

  • Add a one-time listener for a given event.

    Type parameters

    Parameters

    Returns this

removeAllListeners

  • removeAllListeners(event?: EventEmitter.EventNames<ClientEvents>): this
  • Remove all listeners, or those of the specified event.

    Parameters

    Returns this

removeListener

  • removeListener<T>(event: T, fn?: EventEmitter.EventListener<ClientEvents, T>, context?: Context, once?: undefined | false | true): this
  • Remove the listeners of a given event.

    Type parameters

    Parameters

    • event: T
    • Optional fn: EventEmitter.EventListener<ClientEvents, T>
    • Optional context: Context
    • Optional once: undefined | false | true

    Returns this

Generated using TypeDoc