EventHelper

new Cesium.EventHelper()

一个方便的对象,简化了附加事件侦听器的常见模式 添加到多个事件中,然后稍后立即删除所有这些侦听器,例如,在 销毁方法。
Example:
const helper = new Cesium.EventHelper();

helper.add(someObject.event, listener1, this);
helper.add(otherObject.event, listener2, this);

// later...
helper.removeAll();
See:

Methods

向事件添加侦听器,并记录注册以供稍后清理。
Name Type Description
event Event 要附加到的事件。
listener function 引发事件时要执行的函数。
scope object optional 一个可选的对象范围,用作 this 侦听器函数将在其中执行的指针。
Returns:
一个函数,该函数将在调用时删除此事件侦听器。
See:
取消注册所有以前添加的侦听器。
See:

Type Definitions

Cesium.EventHelper.RemoveCallback()

删除侦听器的函数。
Need help? The fastest way to get answers is from the community and team on the Cesium Forum.