Options
All
  • Public
  • Public/Protected
  • All
Menu

Represents a named event which can have multiple subscriptions. Subscriptions are functions that are executed and passed event args when an event is raised.

Hierarchy

  • Event

Implements

Index

Constructors

constructor

  • Initializes a new instance of the {@link geocortex.framework.events.Event} class.

    Parameters

    • name: string

      The name of this event.

    • Optional app: Application

      The {@link framework.application.Application} that this event belongs to.

    Returns Event

Properties

app

The {@link geocortex.framework.application.Application} that this event instance belongs to. Set to null for private/internal events.

isPublishing

isPublishing: boolean

Is this event currently being published? This flag can be used to prevent unwanted recursive behaviour.

name

name: string

The name of this event.

Methods

clear

  • clear(): void
  • Removes all registered handlers from this event.

    Returns void

getSubscriptionHandlerByToken

  • getSubscriptionHandlerByToken(token: string): function
  • Gets a subscription handler given a subscription token.

    Parameters

    • token: string

      The subscription token to get the subscription for.

    Returns function

      • (args: any): void
      • Parameters

        • args: any

        Returns void

once

  • once(scope: any, handler: function): string
  • Subscribes an event handler for a single publishing of this event, returning a subscription token which can later be used to unsubscribe the handler from this event.

    Parameters

    • scope: any

      The scope for which to execute the handler in. It will become "this" inside of the handler when fired.

    • handler: function

      The handler function to execute.

        • (args: any): void
        • Parameters

          • args: any

          Returns void

    Returns string

publish

  • publish(...parameters: any[]): void
  • Raises this event, sequentially executing every registered handler.

    Parameters

    • Rest ...parameters: any[]

      Parameters to pass to each handler.

    Returns void

subscribe

  • subscribe(scope: any, handler: function): string
  • Subscribes an event handler to this event, returning a subscription token which can later be used to unsubscribe the handler from this event.

    Parameters

    • scope: any

      The scope for which to execute the handler in. It will become "this" inside of the handler when fired.

    • handler: function

      The handler function to execute.

        • (args: any): void
        • Parameters

          • args: any

          Returns void

    Returns string

unsubscribe

  • unsubscribe(token: string): boolean
  • Unsubscribes a handler from this event, given its token.

    Parameters

    • token: string

      The subscription token previously obtained by subscribing to this event.

    Returns boolean