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