当前位置: 首页 > 文档资料 > ThingJS 文档中心 >

Class: EventTrigger

优质
小牛编辑
128浏览
2023-12-01

THING~ EventTrigger

EventTrigger The event trigger.


new EventTrigger(param)

constructor.

Parameters:
NameTypeDescription
paramObject

The initial parameters.

Methods


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

Add event listener.

Parameters:
NameTypeDescription
typeString

The event type.

objectTHING.BaseObject

The object what to bind.

conditionString

The condition to select children of object.

callbackfunction

The callback function.

tagString

The event tag.

priorityNumber

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

onceBoolean

True indicates just trigger once time.

userDataObject

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


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

Trigger event.

Parameters:
NameTypeDescription
typeString

The event type.

objectTHING.BaseObject

The object what to bind.

evObject

The event info.

tagString

The event tag.

Returns:
Type
Object

dispose()

Dispose.


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

Get event listener.

Parameters:
NameTypeDescription
typeString

The event type.

objectTHING.BaseObject

The object what to bind.

conditionString

The condition to select children of object.

tagString

The event tag.

Returns:
Type
Object

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

Get event listeners by object.

Parameters:
NameTypeDescription
typeString

The event type.

objectTHING.BaseObject

The object what to bind.

Returns:
Type
Array.<Object>

invokeListener(listener, ev)

Invoke listener.

Parameters:
NameTypeDescription
listenerObject

The listener.

evObject

The event info.


removeAllEventListeners(object)

Remove all event listeners.

Parameters:
NameTypeDescription
objectTHING.BaseObject

The object what to bind.


removeEventListener(type, object, tag)

Remove event listener.

Parameters:
NameTypeDescription
typeString

The event type.

objectTHING.BaseObject

The object what to bind.

tagString

The event tag.


traverseListener(callback)

Traverse listener.

Parameters:
NameTypeDescription
callbackfunction

The callback function.


traverseListenerByType(type, callback)

Traverse listener by type.

Parameters:
NameTypeDescription
typeString

The event type.

callbackfunction

The callback function.