SpriteEventDispatcher

Type class

An EventDispatcher for Sprite.

Click here for more info

Sources

This information about SpriteEventDispatcher is provided for reference only and is not available through exported packages and thus should not be imported or used on its own.

Inheritance

SpriteEventDispatcher extends EventDispatcher.

SpriteEventDispatcher is not extended by any other symbol.

Settings

SpriteEventDispatcher does not have any settings.

Private settings

SpriteEventDispatcher does not have any private settings.

Properties

SpriteEventDispatcher does not have any properties.

Methods

constructor(

sprite: Sprite

)

#

Returns SpriteEventDispatcher

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: E[""]

)

#

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?: undefined | ( this: C, event: E[""]) => 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?: undefined | ( this: C, event: E[""]) => void,
context?: C

)

#

Returns void

Inherited from EventDispatcher

Removes the event listener with specific parameters.

on(

type: Key,
callback: ( this: C | undefined, event: E[""]) => void,
context?: C,
shouldClone: boolean

)

#

Returns IDisposer

Inherited from EventDispatcher

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

button.events.once("click", (ev) => {
  console.log("Button clicked");
}, this);
button.events.once("click", (ev) => {
  console.log("Button clicked");
}, this);

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

onAll(

callback: ( this: C, event: E[""]) => void,
context?: C,
shouldClone: boolean

)

#

Returns IDisposer

Inherited from EventDispatcher

Creates an event listener to be invoked on any event.

once(

type: Key,
callback: ( this: C | undefined, event: E[""]) => 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.

button.events.once("click", (ev) => {
  console.log("Button clicked");
}, this);
button.events.once("click", (ev) => {
  console.log("Button clicked");
}, this);

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

removeType(

type: Key

)

#

Returns void

Inherited from EventDispatcher

Removes all listeners of a particular event type

stopParentDispatch()

#

Returns void

Will stop any bubbling up of the event to element's parents.

Should be called in an event handler, e.g.:

element.events.on("pointerdown", function(ev) {
  // Do something here and prevent from "pointerdown" bubbling up
  // ...
  ev.target.events.stopParentDispatch();
});
element.events.on("pointerdown", function(ev) {
  // Do something here and prevent from "pointerdown" bubbling up
  // ...
  ev.target.events.stopParentDispatch();
});

There are 16 inherited items currently hidden from this list.

Events

SpriteEventDispatcher does not have any events.