OpenGeoscience/geojs — pull request #189 by jbeezley (2014-09-15 15:04:40+00:00)
Title: [WIP] Native jquery events

This adds a compatibility layer between GeoJS and jQuery event handling interfaces. The GeoJS interface now requires namespacing event handlers like jQuery does it. Otherwise, the GeoJS object `on`, `off`, and `trigger` methods work the same. With the compatibility layer, you can now attach handlers with jQuery directly, so the following are equivalent:

```javascript
function doSomething(evt, data) {
...
}
$(map).on(geo.event.zoom, doSomething);
$(map).trigger(geo.event.zoom, {}, data);
```

```javascript
function doSomething(data) {
...
}
map.on(geo.event.zoom, doSomething);
map.trigger(geo.event.zoom, data);
```

Note the difference in call signature. For compatibility, the GeoJS methods don't use the jQuery event objects, but I'm willing to consider changing this. I still need to go through the code to make sure that in source handlers are properly namespaced.