Interface IEventPowered

Index

Methods

Methods

public addEventListener(type: string, fn: (e: L.LeafletEvent) => void, context?: any): T in L.IEventPowered<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

  • type: string
  • fn: (e: L.LeafletEvent) => void
  • context?: any optional

Returns

T in L.IEventPowered<T>

public addEventListener(eventMap: any, context?: any): T in L.IEventPowered<T>

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

Parameters

  • eventMap: any
  • context?: any optional

Returns

T in L.IEventPowered<T>

public addOneTimeEventListener(type: string, fn: (e: L.LeafletEvent) => void, context?: any): T in L.IEventPowered<T>

The same as above except the listener will only get fired once and then removed.

Parameters

  • type: string
  • fn: (e: L.LeafletEvent) => void
  • context?: any optional

Returns

T in L.IEventPowered<T>

public clearAllEventListeners(): T in L.IEventPowered<T>

Removes all listeners to all events on the object.

Returns

T in L.IEventPowered<T>

public fire(type: string, data?: any): T in L.IEventPowered<T>

Alias to fireEvent.

Parameters

  • type: string
  • data?: any optional

Returns

T in L.IEventPowered<T>

public fireEvent(type: string, data?: any): T in L.IEventPowered<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
  • data?: any optional

Returns

T in L.IEventPowered<T>

public hasEventListeners(type: string): boolean

Returns true if a particular event type has some listeners attached to it.

Parameters

  • type: string

Returns

boolean

public off(type: string, fn?: (e: L.LeafletEvent) => void, context?: any): T in L.IEventPowered<T>

Alias to removeEventListener.

Parameters

  • type: string
  • fn?: (e: L.LeafletEvent) => void optional
  • context?: any optional

Returns

T in L.IEventPowered<T>

public off(eventMap?: any, context?: any): T in L.IEventPowered<T>

Alias to removeEventListener.

Parameters

  • eventMap?: any optional
  • context?: any optional

Returns

T in L.IEventPowered<T>

public on(type: string, fn: (e: L.LeafletEvent) => void, context?: any): T in L.IEventPowered<T>

Alias to addEventListener.

Parameters

  • type: string
  • fn: (e: L.LeafletEvent) => void
  • context?: any optional

Returns

T in L.IEventPowered<T>

public on(eventMap: any, context?: any): T in L.IEventPowered<T>

Alias to addEventListener.

Parameters

  • eventMap: any
  • context?: any optional

Returns

T in L.IEventPowered<T>

public once(type: string, fn: (e: L.LeafletEvent) => void, context?: any): T in L.IEventPowered<T>

Alias to addOneTimeEventListener.

Parameters

  • type: string
  • fn: (e: L.LeafletEvent) => void
  • context?: any optional

Returns

T in L.IEventPowered<T>

public removeEventListener(type: string, fn?: (e: L.LeafletEvent) => void, context?: any): T in L.IEventPowered<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
  • fn?: (e: L.LeafletEvent) => void optional
  • context?: any optional

Returns

T in L.IEventPowered<T>

public removeEventListener(eventMap?: any, context?: any): T in L.IEventPowered<T>

Removes a set of type/listener pairs.

Parameters

  • eventMap?: any optional
  • context?: any optional

Returns

T in L.IEventPowered<T>