Show:

Simple custom event implementation.

Index

Methods

Properties

Methods

attach

(
  • type
  • listener
)

Adds a listener for a given event type.

Parameters:

  • type String

    The type of event to add a listener for.

  • listener Function

    The function to call when the event occurs.

detach

(
  • type
  • listener
)

Removes a listener for a given event type.

Parameters:

  • type String

    The type of event to remove a listener from.

  • listener Function

    The function to remove from the event.

fire

(
  • event
)

Fires an event based on the passed-in object.

Parameters:

  • event Object | String

    An object with at least a 'type' attribute or a string indicating the event name.

subscribe

(
  • type
  • listener
)
deprecated

Adds a listener for a given event type.

Parameters:

  • type String

    The type of event to add a listener for.

  • listener Function

    The function to call when the event occurs.

unsubscribe

(
  • type
  • listener
)
deprecated

Removes a listener for a given event type.

Parameters:

  • type String

    The type of event to remove a listener from.

  • listener Function

    The function to remove from the event.

Properties

_handlers

Object private static

Event handlers for the various events.