ibdknox/pinot — Issue #10: Event Listener removal
Author: davesann
Created: 2011-10-16 02:40:18+00:00
State: open

I think that it is easily forgotten but good practice to remove unneeded event listeners.

Consider modification of "on" to return a list of listener ids rather than the target element.
These can be used to remove listeners with goog.events.unlistenByKey

I think that "unlistening" by function may not be possible because of the wrapper functions that you use.

as below:

(defn on [elem event func]
(let [ev-name (string/upper-case (name event))
event (aget events/EventType ev-name)
body-elem (get-body)]
(doall (map
(fn [el]
(let [parsed (->target el)]
(events/listen body-elem
event
(make-listener func parsed))))
(pclj/->coll elem)))
))