Register a callback for a specific timeline event.
429443
def add_timeline_callback(self, timeline_events, callback):
        """"""
        if not timeline_events:
            return False

        if not isinstance(timeline_events, (tuple, list)):
            timeline_events = [timeline_events]

        for timeline_event in timeline_events:
            if not isinstance(timeline_event, dict):
                raise AbodeException((ERROR.EVENT_CODE_MISSING))

            event_code = timeline_event.get('event_code')

            if not event_code:
                raise AbodeException((ERROR.EVENT_CODE_MISSING))

            _LOGGER.debug("Subscribing to timeline event: %s", timeline_event)

            self._timeline_callbacks[event_code].append((callback))

        return True
869521
public void select(TimelineEvent event, TimelineUpdater timelineUpdater) {
        int index = getIndex(event);

        if (timelineUpdater != null) {
            // update UI
            timelineUpdater.select(index);
        }
    }
1188662
function registerEventListener(eventList, callback) {
        for (var x = 0; x < eventList.length; x++) {
            if (POINTER_MOVE.indexOf(eventList[x]) === -1) {
                me.input.pointerEventTarget.addEventListener(eventList[x], callback, { passive: (api.preventDefault === false) });
            }
        }
    }
1209440
public function registerTimer($ms, callable $callBack, $params = [], $tickType = Macro::SWOOLE_TIMER_TICK)
    {
        $this->userRegisterTimer[] = [$ms, $callBack, $params, $tickType];
    }
434497
def __callback(self, event, *args, **kwargs):
        # type: (str, *Any, **Any) -> Any
        
        comp_callback = self.context.get_callback(event)
        if not comp_callback:
            # No registered callback
            return True

        # Call it
        result = comp_callback(self.instance, *args, **kwargs)
        if result is None:
            # Special case, if the call back returns nothing
            return True

        return result
735779
def register_callback(self, callback, remove=False):
        """"""

        # (Un)Register the callback.
        if remove and callback in self.callbacks:
            self.callbacks.remove(callback)
        elif not remove and callback not in self.callbacks:
            self.callbacks.append(callback)
1191598
async def _trigger_event(self, event, namespace, *args):
        """"""
        # first see if we have an explicit handler for the event
        if namespace in self.handlers and event in self.handlers[namespace]:
            if asyncio.iscoroutinefunction(self.handlers[namespace][event]) \
                    is True:
                try:
                    ret = await self.handlers[namespace][event](*args)
                except asyncio.CancelledError:  # pragma: no cover
                    ret = None
            else:
                ret = self.handlers[namespace][event](*args)
            return ret

        # or else, forward the event to a namepsace handler if one exists
        elif namespace in self.namespace_handlers:
            return await self.namespace_handlers[namespace].trigger_event(
                event, *args)
114004
def add_watcher(self, fd, callback):
        """"""

        if not isinstance(fd, int):
            fd = fd.fileno()

        self.callbacks[fd] = callback
        self.epoll.register(fd, EPOLLIN)
692163
def register_on_event_source_changed(self, callback):
        
        event_type = library.VBoxEventType.on_event_source_changed
        return self.event_source.register_callback(callback, event_type)
289179
def register(self, event, fn):
        
        self._callbacks.setdefault(event, []).append(fn)
        return fn
1148899
def trigger(self, event: str, *args: T.Any, **kw: T.Any) -> bool:
        """"""

        callbacks = list(self._events.get(event, []))
        if not callbacks:
            return False

        for callback in callbacks:
            callback(*args, **kw)
        return True
345163
def register_on_state_changed(self, callback):
        
        event_type = library.VBoxEventType.on_state_changed
        return self.event_source.register_callback(callback, event_type)
85206
def push_event(self, evt):
        """"""
        try:
            self._push_event(evt)
        except Exception as e:
            print("Unexpected error in callback for %s: %s"
                  % (str(evt), str(e)), file=self._fd)
1043599
def _notification_callback(method, params):
        """"""
        def callback(future):
            try:
                future.result()
                log.debug("Successfully handled async notification %s %s", method, params)
            except Exception:  # pylint: disable=broad-except
                log.exception("Failed to handle async notification %s %s", method, params)
        return callback
138574
def after(self, time, function, args = []):
        """"""
        callback_id = self.tk.after(time, self._call_wrapper, time, function, *args)
        self._callback[function] = [callback_id, False]
856212
def add_callback(self, fn, *args, **kwargs):
        """"""
        if _debug: IOCB._debug("add_callback(%d) %r %r %r", self.ioID, fn, args, kwargs)

        # store it
        self.ioCallback.append((fn, args, kwargs))

        # already complete?
        if self.ioComplete.isSet():
            self.trigger()
659306
public function registerEvent($event, $callback)
    {
        $eventManager = $this->getServiceLocator()->get(EventManager::CONFIG_ID);
        $eventManager->attach($event, $callback);
        $this->getServiceManager()->register(EventManager::CONFIG_ID, $eventManager);
    }