Appearance
@jtopo/core / EventTarget
Class: EventTarget
事件对象, 可以监听和分发事件
Hierarchy
Table of contents
Constructors
Methods
Constructors
constructor
new EventTarget()
Methods
addEventListener
addEventListener(type
, callback
): void
增加事件监听
Parameters
Name | Type | Description |
---|---|---|
type | string | 事件类型 |
callback | Function |
Returns
void
dispatchEvent
dispatchEvent(event
): void
分发事件
Parameters
Name | Type |
---|---|
event | Event | EventBase |
Returns
void
hasListener
hasListener(type
): boolean
是否有该类型的监听
Parameters
Name | Type |
---|---|
type | string |
Returns
boolean
removeEventListener
removeEventListener(type
, callback
): any
移除一个事件监听
Parameters
Name | Type |
---|---|
type | string |
callback | Function |
Returns
any