Options
All
  • Public
  • Public/Protected
  • All
Menu

Class SharedWorkerMessageRouter

A message router is responsible for receiving messages from a shared worker and passing them on to the correct connectors. Each named client session will register one connector.

Hierarchy

  • SharedWorkerMessageRouter

Index

Constructors

constructor

Properties

Private listeners

listeners: object

The listeners indexed by the session name.

Type declaration

  • [sessionName: string]: Array<function>

Private worker

worker: SharedWorker

The shared worker containing the shared session

Methods

addListener

  • addListener(sessionName: string, listener: function): void
  • Add a listener callback to messages coming from a named shared session.

    Parameters

    • sessionName: string

      the name of the shared session

    • listener: function

      the callback function

        • (command: string, ...messages: any[]): void
        • Parameters

          • command: string
          • Rest ...messages: any[]

          Returns void

    Returns void

getWorker

  • Get the underlying shared worker

    Returns SharedWorker

    the shared worker

removeListener

  • removeListener(sessionName: string, listener: function): void
  • Remove a listener

    Parameters

    • sessionName: string

      the name of the shared session

    • listener: function
        • (command: string, ...messages: any[]): void
        • Parameters

          • command: string
          • Rest ...messages: any[]

          Returns void

    Returns void