The type code of acceleration event listener.
The type code of custom event listener.
The type code of keyboard event listener.
The type code of mouse event listener.
The type code of all at once touch event listener.
The type code of one by one touch event listener.
The type code of unknown event listener.
Gets the fixed priority of this listener
如果它是场景图优先级侦听器则返回 0 ,则对于固定优先级侦听器则不为零
Gets the listener ID of this listener
When event is being dispatched, listener ID is used as key for searching listeners according to event type.
Gets scene graph priority of this listener
如果它是固定优先级侦听器,则为场景图优先级侦听器非 null 。
Gets the type of this listener
note: It's different from EventType
, e.g.
TouchEvent has two kinds of event listeners - EventListenerOneByOne, EventListenerAllAtOnce
Checks whether the listener is paused.
Checks whether the listener was registered by EventDispatcher
Sets the fixed priority for this listener
note: This method is only used for fixed priority listeners
,
it needs to access a non-zero value. 0 is reserved for scene graph priority listeners
Sets paused state for the listener
The paused state is only used for scene graph priority listeners.
`EventDispatcher::resumeAllEventListenersForTarget(node)` will set the paused state to `true`,
while `EventDispatcher::pauseAllEventListenersForTarget(node)` will set it to `false`.
@note 1) Fixed priority listeners will never get paused. If a fixed priority doesn't want to receive events,
call `setEnabled(false)` instead.
2) In `Node`'s onEnter and onExit, the `paused state` of the listeners
which associated with that node will be automatically updated.
Marks the listener was registered by EventDispatcher.
Sets scene graph priority for this listener
Checks whether the listener is available.
Clones the listener, its subclasses have to override this method.
Checks whether the listener is enabled
Enables or disables the listener
note: Only listeners with enabled
state will be able to receive events.
When an listener was initialized, it's enabled by default.
An event listener can receive events when it is enabled and is not paused.
paused state is always false when it is a fixed priority listener.
Create a EventListener object with configuration including the event type, handlers and other parameters.
In handlers, this refer to the event listener object itself.
You can also pass custom parameters in the configuration object,
all custom parameters will be polyfilled into the event listener object and can be accessed in handlers.
a json object
Generated using TypeDoc
The base class of event listener.
If you need custom listener which with different callback, you need to inherit this class.
For instance, you could refer to EventListenerAcceleration, EventListenerKeyboard,
EventListenerTouchOneByOne, EventListenerCustom.
封装用户的事件处理逻辑。
注意:这是一个抽象类,开发者不应该直接实例化这个类,请参考 create 。