Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • ClientConnection
    • IClientConnection

Index

Constructors

constructor

  • Parameters

    • Optional options: any

    Returns IClientConnection

Properties

connected

connected: boolean

Indicates if a connection has been established

Protected connectionStep

connectionStep: string

Protected connectionTimeout

connectionTimeout: number

Protected defaultOptions

defaultOptions: ConnectionSettings

id

id: string | null

Protected messageListener

messageListener: any

Protected options

options: ConnectionSettings

Protected port

port: MessagePort

Protected promises

promises: Promises

Methods

Protected addBeforeUnloadEvent

  • addBeforeUnloadEvent(): void
  • Returns void

Protected clearConnectionTimeout

  • clearConnectionTimeout(): void
  • Returns void

close

  • close(): void
  • Close the port being used to communicate. It will prevent any further messages being sent or received.

    Returns void

Protected completeBacklog

  • completeBacklog(): void
  • Returns void

emit

  • emit(event: string, payload?: any): this
  • This method will emit an event to its counterpart.

    Parameters

    • event: string

      The name of the event to emit.

    • Optional payload: any

      Payload to be sent with the event.

    Returns this

    Returns Connection instance.

Protected finishInit

  • finishInit(): void
  • Returns void

Protected getRequestTimeout

  • getRequestTimeout(timeout: number | boolean | undefined): number | boolean
  • Parameters

    • timeout: number | boolean | undefined

    Returns number | boolean

Protected handleError

  • handleError(error: any): void
  • Parameters

    • error: any

    Returns void

Protected handleMessage

  • handleMessage(message: Message): void
  • Parameters

    • message: Message

    Returns void

init

  • init(): void
  • Returns void

Protected initPortEvents

  • initPortEvents(): void
  • Returns void

Protected isClient

  • isClient(): boolean
  • Returns boolean

Protected listenForHandshake

  • listenForHandshake(): void
  • Returns void

Protected message

  • message(message: Message): void
  • Parameters

    • message: Message

    Returns void

on

  • on(event: string, callback: Function): this
  • Bind a callback to an event.

    Parameters

    • event: string

      The name of the event to listen for.

    • callback: Function

      The function to call when the event is fired.

    Returns this

    Returns Connection instance.

request

  • request<T>(event: string, payload?: any, options?: RequestOptions): Promise<T>
  • Make a request of the counterpart. It will automatically reject the promise if the timeout time is exceeded.

    Type parameters

    • T

    Parameters

    • event: string

      The name of the event to emit

    • Optional payload: any

      Payload to be sent with the request

    • Optional options: RequestOptions

    Returns Promise<T>

    A promise that can resolve with any payload

Protected setConnectionTimeout

  • setConnectionTimeout(): void
  • Returns void

Protected uuidv4

  • uuidv4(): string
  • Returns string

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Type alias with type parameter
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method

Generated using TypeDoc