Options
All
  • Public
  • Public/Protected
  • All
Menu

@nextcloud/event-bus

Index

Namespaces

Classes

Interfaces

Variables

Functions

Variables

Const bus

bus: EventBus = getBus()

Functions

emit

  • emit(name: string, event: object): void
  • Emit an event

    Parameters

    • name: string

      name of the event

    • event: object

      event payload

    Returns void

getBus

subscribe

  • subscribe(name: string, handler: (string: any) => void): void
  • Register an event listener

    Parameters

    • name: string

      name of the event

    • handler: (string: any) => void

      callback invoked for every matching event emitted on the bus

        • (string: any): void
        • Parameters

          • string: any

          Returns void

    Returns void

unsubscribe

  • unsubscribe(name: string, handler: (string: any) => void): void
  • Unregister a previously registered event listener

    Note: doesn't work with anonymous functions (closures). Use method of an object or store listener function in variable.

    Parameters

    • name: string

      name of the event

    • handler: (string: any) => void

      callback passed to subscribed

        • (string: any): void
        • Parameters

          • string: any

          Returns void

    Returns void

Generated using TypeDoc