一个便利对象,简化了将事件监听器
附加到多个事件,然后在稍后(例如,
在销毁方法中)一次性移除所有那些监听器的常见模式。
Example:
const helper = new Cesium.EventHelper();
helper.add(someObject.event, listener1, this);
helper.add(otherObject.event, listener2, this);
// 稍后...
helper.removeAll();
See:
Methods
add(event, listener, scope) → EventHelper.RemoveCallback
向事件添加监听器,并记录注册以便稍后清理。
| Name | Type | Description |
|---|---|---|
event |
Event | 要附加到的事件。 |
listener |
function | 事件触发时要执行的函数。 |
scope |
object |
optional
可选的对象作用域,作为this
指针,监听器函数将在其中执行。 |
Returns:
调用时将移除此事件监听器的函数。
取消注册所有先前添加的监听器。
Type Definitions
移除监听器的函数。
