Add an object.geoIsOn function to determine if an event is bound.
MODIFY
src/object.js
src/object.js
@@ -88,6 +88,27 @@ var object = function () {
return m_this;
};
+ /**
+ * Report if an event handler is bound to this object.
+ *
+ * @param {string|string[]} event An event or list of events to check.
+ * @param {function} [handler] A function that might be bound. If
+ * `undefined`, this will report `true` if there is any handler for the
+ * specified event.
+ * @returns {boolean} true if any of the specified events are bound to the
+ * specified handler.
+ */
+ this.geoIsOn = function (event, handler) {
+ if (Array.isArray(event)) {
+ return event.some(function (e) {
+ return m_this.geoIsOn(e, handler);
+ });
+ }
+ return (m_eventHandlers[event] || []).some(function (h) {
+ return h === handler || handler === undefined;
+ });
+ };
+
/**
* Trigger an event (or events) on this object and call all handlers.
*

MODIFY
tests/cases/object.js
tests/cases/object.js
@@ -20,7 +20,12 @@ describe('geo.object', function () {
evtData = {},
foo = new CallCounter(evtData);
+ expect(obj.geoIsOn('testevent')).toBe(false);
obj.geoOn('testevent', foo.call);
+ expect(obj.geoIsOn('testevent')).toBe(true);
+ expect(obj.geoIsOn(['testevent', 'anotherevent'])).toBe(true);
+ expect(obj.geoIsOn('testevent', 'not foo.call')).toBe(false);
+ expect(obj.geoIsOn('testevent', foo.call)).toBe(true);
obj.geoTrigger('anotherevent', evtData);
expect(foo.ncalls).toBe(0);

Add an object.geoIsOn function to determine if an event is bound.