A convenience object that simplifies the common pattern of attaching event listeners
to several events, then removing all those listeners at once later, for example, in
a destroy method.
使用示例:
const helper = new Cesium.EventHelper();
helper.add(someObject.event, listener1, this);
helper.add(otherObject.event, listener2, this);
// later...
helper.removeAll();
参考:
方法
add(event, listener, scope) → EventHelper.RemoveCallback
Adds a listener to an event, and records the registration to be cleaned up later.
参数名称 | 类型 | 描述信息 |
---|---|---|
event |
Event | The event to attach to. |
listener |
function | The function to be executed when the event is raised. |
scope |
object |
可选
An optional object scope to serve as the this
pointer in which the listener function will execute. |
返回值:
A function that will remove this event listener when invoked.
Unregisters all previously added listeners.
定义的类型
A function that removes a listener.