业务咨询
开发咨询
微信沟通

Class: EventTrigger

THING~ EventTrigger

EventTrigger The event trigger.


new EventTrigger(param)

constructor.

Parameters:
Name Type Description
param Object

The initial parameters.

Methods


addEventListener(type, object, condition, callback, tag, priority, once, userData)

Add event listener.

Parameters:
Name Type Description
type String

The event type.

object THING.BaseObject

The object what to bind.

condition String

The condition to select children of object.

callback function

The callback function.

tag String

The event tag.

priority Number

The priority value(default is 50, highger value will be processed first)

once Boolean

True indicates just trigger once time.

userData Object

The event user data what would trigger by event data with key as 'data'.


dispatchEvent(type, object, ev, tag) → {Object}

Trigger event.

Parameters:
Name Type Description
type String

The event type.

object THING.BaseObject

The object what to bind.

ev Object

The event info.

tag String

The event tag.

Returns:
Type
Object

dispose()

Dispose.


getEventListener(type, object, condition, tag) → {Object}

Get event listener.

Parameters:
Name Type Description
type String

The event type.

object THING.BaseObject

The object what to bind.

condition String

The condition to select children of object.

tag String

The event tag.

Returns:
Type
Object

getEventListeners(type, object) → {Array.<Object>}

Get event listeners by object.

Parameters:
Name Type Description
type String

The event type.

object THING.BaseObject

The object what to bind.

Returns:
Type
Array.<Object>

invokeListener(listener, ev)

Invoke listener.

Parameters:
Name Type Description
listener Object

The listener.

ev Object

The event info.


removeAllEventListeners(object)

Remove all event listeners.

Parameters:
Name Type Description
object THING.BaseObject

The object what to bind.


removeEventListener(type, object, tag)

Remove event listener.

Parameters:
Name Type Description
type String

The event type.

object THING.BaseObject

The object what to bind.

tag String

The event tag.


traverseListener(callback)

Traverse listener.

Parameters:
Name Type Description
callback function

The callback function.


traverseListenerByType(type, callback)

Traverse listener by type.

Parameters:
Name Type Description
type String

The event type.

callback function

The callback function.