SpriteEventDispatcher

Type class

An EventDispatcher for Sprite.

Sources

SpriteEventDispatcher can be used (imported) via one of the following packages.

// SpriteEventDispatcher is available in all of the following modules.
// You only need to import one of them.

/**
 * --------------------------------------------------------
 * Import from: "core.ts"
 * Use like: am4core.SpriteEventDispatcher
 * --------------------------------------------------------
 */
import * as am4core from "@amcharts/amcharts4/core";

// SpriteEventDispatcher is available in all of the following modules.
// You only need to import one of them.

/**
 * --------------------------------------------------------
 * Include via: <script src="core.js"></script>
 * Access items like: am4core.SpriteEventDispatcher
 * --------------------------------------------------------
 */

Inheritance

SpriteEventDispatcher extends TargetedEventDispatcher.

SpriteEventDispatcher is not extended by any other symbol.

Properties

target
#

Type Sprite

Inherited from TargetedEventDispatcher

A target object which is originating events using this dispatcher.

There is 1 inherited item currently hidden from this list.

Methods

constructor(

target: Sprite

)

#

Returns SpriteEventDispatcher

Inherited from TargetedEventDispatcher

Constructor

copyFrom(

source: this

)

#

Returns void

Inherited from TargetedEventDispatcher

Copies all dispatcher parameters, including listeners, from another event dispatcher.

disable()

#

Returns void

Inherited from EventDispatcher

Disable dispatching of events until re-enabled by enable().

disableType(

type: Key,
amount: number

)

#

Returns void

Inherited from EventDispatcher

Disable dispatching of events for a certain event type.

Optionally, can set how many dispatches to skip before automatically re-enabling the dispatching.

dispatch(

type: Key,
event: T[Key]

)

#

Returns void

Inherited from EventDispatcher

Shelves the event to be dispatched within next update cycle.

@todo automatically add in type and target properties if they are missing

dispatchImmediately(

type: Key,
event: T[Key]

)

#

Returns void

Inherited from EventDispatcher

Dispatches an event immediately without waiting for next cycle.

@todo automatically add in type and target properties if they are missing

dispose()

#

Returns void

Inherited from EventDispatcher

Dispose (destroy) this object.

enable()

#

Returns void

Inherited from EventDispatcher

Enable dispatching of events if they were previously disabled by disable().

enableType(

type: Key

)

#

Returns void

Inherited from EventDispatcher

Enable dispatching particular event, if it was disabled before by disableType().

has(

type: Key,
callback?: ( this: C, event: T[Key]) => void,
context?: C

)

#

Returns boolean

Inherited from EventDispatcher

Checks if there's already a listener with specific parameters.

hasListeners()

#

Returns boolean

Inherited from EventDispatcher

Checks if this particular event dispatcher has any listeners set.

hasListenersByType(

type: Key

)

#

Returns boolean

Inherited from EventDispatcher

Checks if this particular event dispatcher has any particular listeners set.

isDisposed()

#

Returns boolean

Inherited from EventDispatcher

Returns if this object has been already disposed.

isEnabled(

type: Key

)

#

Returns boolean

Inherited from EventDispatcher

Checks if dispatching for particular event type is enabled.

off(

type: Key,
callback?: ( this: C, event: T[Key]) => void,
context?: C

)

#

Returns void

Inherited from EventDispatcher

Removes the event listener with specific parameters.

on(

type: Key,
callback: ( this: C, event: T[Key]) => void,
context?: C,
shouldClone: boolean

)

#

Returns IDisposer

Inherited from EventDispatcher

Creates an event listener to be invoked on a specific event type.

series.events.on("hidden", (ev) => {
  console.log("Series hidden: " + ev.target.name);
}, this);
series.events.on("hidden", function(ev) {
  console.log("Series hidden: " + ev.target.name);
}, this);
{
  // ...
  "series": [{
    // ...
    "events": {
    	"hidden": function(ev) {
    	  console.log("Series hidden: " + ev.target.name);
    	}
    }
  }]
}

The above will invoke our custom event handler whenever series we put event on is hidden.

@todo what if listen is called on the same function twice ?

onAll(

callback: ( this: C, type: Key, event: T[Key]) => void,
context?: C,
shouldClone: boolean

)

#

Returns IDisposer

Inherited from EventDispatcher

Creates an event listener to be invoked on any event.

@todo what if listen is called on the same function twice ?

once(

type: Key,
callback: ( this: C, event: T[Key]) => void,
context?: C,
shouldClone: boolean

)

#

Returns IDisposer

Inherited from EventDispatcher

Creates an event listener to be invoked on a specific event type once.

Once the event listener is invoked, it is automatically disposed.

series.events.on("hidden", (ev) => {
  console.log("Series hidden: " + ev.target.name);
}, this);
series.events.on("hidden", function(ev) {
  console.log("Series hidden: " + ev.target.name);
}, this);
{
  // ...
  "series": [{
    // ...
    "events": {
    	"hidden": function(ev) {
    	  console.log("Series hidden: " + ev.target.name);
    	}
    }
  }]
}

The above will invoke our custom event handler the first time series we put event on is hidden.

@todo what if listen is called on the same function twice ?

There are 18 inherited items currently hidden from this list.

Events

SpriteEventDispatcher does not have any events.

Adapters

SpriteEventDispatcher does not have any adapters.