Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface IEventPowered<T>

Type parameters

  • T

Hierarchy

Implemented by

Index

Methods

addEventListener

  • addEventListener(type: string, fn: function, context?: any): T
  • addEventListener(eventMap: any, context?: any): T
  • Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').

    Parameters

    Returns T

  • Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}

    Parameters

    • eventMap: any
    • Optional context: any

    Returns T

addOneTimeEventListener

  • addOneTimeEventListener(type: string, fn: function, context?: any): T
  • The same as above except the listener will only get fired once and then removed.

    Parameters

    Returns T

clearAllEventListeners

  • clearAllEventListeners(): T
  • Removes all listeners to all events on the object.

    Returns T

fire

  • fire(type: string, data?: any): T
  • Alias to fireEvent.

    Parameters

    • type: string
    • Optional data: any

    Returns T

fireEvent

  • fireEvent(type: string, data?: any): T
  • Fires an event of the specified type. You can optionally provide an data object — the first argument of the listener function will contain its properties.

    Parameters

    • type: string
    • Optional data: any

    Returns T

hasEventListeners

  • hasEventListeners(type: string): boolean
  • Returns true if a particular event type has some listeners attached to it.

    Parameters

    • type: string

    Returns boolean

off

  • off(type: string, fn?: function, context?: any): T
  • off(eventMap?: any, context?: any): T
  • Alias to removeEventListener.

    Parameters

    • type: string
    • Optional fn: function
    • Optional context: any

    Returns T

  • Alias to removeEventListener.

    Parameters

    • Optional eventMap: any
    • Optional context: any

    Returns T

on

  • on(type: string, fn: function, context?: any): T
  • on(eventMap: any, context?: any): T
  • Alias to addEventListener.

    Parameters

    Returns T

  • Alias to addEventListener.

    Parameters

    • eventMap: any
    • Optional context: any

    Returns T

once

  • once(type: string, fn: function, context?: any): T
  • Alias to addOneTimeEventListener.

    Parameters

    Returns T

removeEventListener

  • removeEventListener(type: string, fn?: function, context?: any): T
  • removeEventListener(eventMap?: any, context?: any): T
  • Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object.

    Parameters

    • type: string
    • Optional fn: function
    • Optional context: any

    Returns T

  • Removes a set of type/listener pairs.

    Parameters

    • Optional eventMap: any
    • Optional context: any

    Returns T