一個方便的對象,它簡化了將事件偵聽器附加到多個事件的常見模式,然后在稍后刪除所有這些偵聽器,例如,在銷毀方法中。
new EventHelper()
Example
var helper = new bmgl.EventHelper();
helper.add(someObject.event, listener1, this);
helper.add(otherObject.event, listener2, this);
// later...
helper.removeAll();
See:
Methods
add(event, listener, scope) → {EventHelper~RemoveCallback}
向事件添加偵聽器,并記錄稍后要清除的注冊。
Parameters:
listener
(function)
引發事件時要執行的函數。
scope
(Object)
可選對象作用域,用作偵聽器函數將在其中執行的this
指針。
注銷以前添加的所有偵聽器。
Type Definitions
RemoveCallback()
刪除偵聽器的函數。