Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Channel<Payloads, Names>

Channel class. Allows to bind and unbind event callbacks including whisper events. Allows to trigger client events as well.

Type parameters

Hierarchy

Index

Constructors

constructor

  • new Channel(type: ChannelType, name: string, echo: Echo | null, leaveFunc: function): Channel

Properties

Private _echo

_echo: Echo | null = null

Protected callbacks

callbacks: object

An array of callbacks per event name

Type declaration

  • [eventName: string]: function[]

Private channel

channel: LaravelEchoChannel | null = null

debugEvents

debugEvents: boolean = false

Private leaveFunc

leaveFunc: function

Type declaration

    • (): void
    • Returns void

name

name: string

type

Accessors

echo

  • get echo(): null | Echo
  • set echo(echo: Echo | null): void

Methods

Protected attachListeners

  • attachListeners(eventNames: string | string[]): void
  • Attach event listeners to the real Laravel Echo channel instance.

    Parameters

    • eventNames: string | string[]

    Returns void

dispatch

  • dispatch<T>(name: T, payload: Payloads[T]): void

dispatchWhisper

  • dispatchWhisper(name: string, payload: any): void

leave

  • leave(): void

off

offWhisper

  • offWhisper(name: string, callback: EventCallback<any, any>): void

on

onWhisper

  • onWhisper(name: string, callback: EventCallback<any, any>): void

once

onceWhisper

  • onceWhisper(name: string, callback: EventCallback<any, any>): void

whisper

  • whisper(name: string, data: object): void
  • Trigger a client event.

    Parameters

    • name: string

      Event name

    • data: object

      Event data

    Returns void

Generated using TypeDoc