modestmaps/modestmaps-js — pull request #68 by cmtt (2013-04-02 05:53:51+00:00)
Title: Enabling/Disabling, adding and removing event handlers

A multiplication seems to be a tiny bit faster than a division in a few Gecko browsers, so I changed every "/ 2" to "* 0.5", have a look at: http://jsperf.com/multiply-vs-division

Despite that, this pull request allows event handlers to be de-/attached, removed and added back. In case of MouseWheelHandler, I have re-introduced a bind method (as a polyfill from MDN for old and beloved browsers) due to the _zoomDiv variable. Also, it was necessary to expose MouseHandler's handlers again.

Event handlers must have an id string, otherwise, the following new methods cannot determine what you'd refer to.

map.getHandler({String} id);
map.disableHandler({String} id);
map.enableHandler({String} id);
map.removeHandler({String} id);
map.addHandler({Function} handler);