def on(event, cb): """Subscribes for an event for all markers. Args: event (string): event name cb (function): callback function """ if event in __ehandlers.keys(): __ehandlers[event].append(_event.Event(cb)) else: __ehandlers[event] = [] __ehandlers[event].append(_event.Event(cb))
def on(self, event, cb): """Subscribes for an event only for this marker. Args: event (string): event name cb (function): callback function """ if event in self._ehandlers.keys(): self._ehandlers[event].append(_event.Event(cb)) else: self._ehandlers[event] = [] self._ehandlers[event].append(_event.Event(cb))