Phaser API Documentation

  Version: 
addListener(events)

Description:

Adds one or more native DOM event listeners onto the underlying Element of this Game Object. The event is then dispatched via this Game Objects standard event emitter.

For example:

var div = this.add.dom(x, y, element);

div.addListener('click');

div.on('click', handler);

Parameters:

name type description
events string

The DOM event/s to listen for. You can specify multiple events by separating them with spaces.

Returns:
Description:

This DOM Element instance.

Since: 3.17.0