API Docs for: 3.5.1
Show:

Test.EventTarget Class

Module: test

Simple custom event implementation.

Item Index

Properties

Methods

attach

(
  • type
  • listener
)
Void

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.

Returns:

Void:

detach

(
  • type
  • listener
)
Void

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.

Returns:

Void:

fire

(
  • event
)
Void

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.

Returns:

Void:

subscribe

(
  • type
  • listener
)
Void 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.

Returns:

Void:

unsubscribe

(
  • type
  • listener
)
Void 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.

Returns:

Void:

Properties

_handlers

Object private static

Event handlers for the various events.