Sets the default callback for the specific event.

@param <T>      the type of the input to the operation
@param event    the event for which the callback should be invoked
@param callback the operation to be performed
197830
public <T extends EventObject> void setDefaultEventCallback(
            final CrawlEvent event,
            final Consumer<T> callback) {
        defaultCallbacks.put(event, callback);
    }
208667
public void registerEventCallback(ObjectManagerEventCallback callback)
    {
        if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
            trace.entry(this, cclass, "registerEventCallback", callback);

        objectManagerState.registerEventCallback(callback);

        if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
            trace.exit(this, cclass, "registerEventCallback");
    }
1190756
public function on($event, $callback)
    {
        $this->router->removeAllListeners($event);
        $this->router->on($event, $callback);
    }
123184
public function attach($event, $callback) {
        $events = is_array($event) ? $event : array($event);
        $listeners = $this->getOption(self::OPTION_LISTENERS);
        foreach ($events as $event) {
            $eventObject = is_object($event) ? $event : new GenericEvent($event);
            if (!isset($listeners[$eventObject->getName()])) {
                $listeners[$eventObject->getName()] = array();
            }

            if (!in_array($callback, $listeners[$eventObject->getName()], true)) {
                $listeners[$eventObject->getName()][] = $callback;
            }
        }
        $this->setOption(self::OPTION_LISTENERS, $listeners);
    }
761258
public <V extends Event> B on(EventType<V, ?> type, EventCallbackFn<V> callback) {
        bind(get(), type, callback);
        return that();
    }
744599
protected static function registerObservableEvent(string $event, $callback): void
    {
        if (! isset(static::$dispatcher)) {
            return;
        }

        $event = (new static())->getObservableKey($event);

        static::$dispatcher->listen("{$event}: ".static::class, $callback);
    }
1201459
public final void addCallback(StatusCallback callback) {
        synchronized (callbacks) {
            if (callback != null && !callbacks.contains(callback)) {
                callbacks.add(callback);
            }
        }
    }
221881
public void callManager(final Event event, final Callback callback) {
        if (delegate instanceof DefaultCommunicationClientImpl) {
            ((DefaultCommunicationClientImpl) delegate).submit(new Runnable() {

                public void run() {
                    Object obj = callManager(event);
                    callback.call(obj);
                }
            });
        }
    }
1003241
public void addCustomEventCallback(
            final CrawlEvent event,
            final PatternMatchingCallback callback) {
        customCallbacks.computeIfAbsent(event, key -> new ArrayList<>()).add(callback);
    }
819259
function (implementOn, event, callback) {
	var stringy = callback.toString();

	if (this._cached[stringy]) {

		// Iteratre through the cached callbacks and remove the correct one based on reference
		for(var i=0,numCbs=this._cached[stringy].length; i < numCbs; i++) {
			if (this._cached[stringy][i].raw === callback) {
				implementOn.removeEventListener(event, this._cached[stringy][i].fn);
			}
		}
	}
}
790458
function (object, event, callback) {
        var index = this.indexOf(object);
        var listener = this.listeners[index];
        if (!listener) {
            listener = {
                'object': object,
                'events': {}
            };
            this.listeners.push(listener);
        }

        var callbacks = listener.events[event];
        if (!callbacks) {
            callbacks = [];
            listener.events[event] = callbacks;
        }

        // add the callback if it does not yet exist
        if (callbacks.indexOf(callback) == -1) {
            callbacks.push(callback);
        }
    }
147715
def set_event(self, ref, tk_event, callback):
        
        # has an EventCallback been created for this tk event
        if tk_event not in self._event_callbacks:
            self._event_callbacks[tk_event] = EventCallback(self._widget, self._tks, tk_event)

        # assign this ref to this event callback
        self._refs[ref] = self._event_callbacks[tk_event]

        # set up the callback
        self._refs[ref].set_callback(ref, callback)
877132
@Override
    public void setCallback(SourceCallback callback) {
        try {
            mCallbackLock.lock();
            mCallback = callback;
            mCallbackChanged.signal();
        } finally {
            mCallbackLock.unlock();
        }
    }
1168835
protected final void registerCustomEventCallback(
            final CrawlEvent event,
            final PatternMatchingCallback callback) {
        Validate.notNull(event, "The event cannot be null.");
        Validate.notNull(callback, "The callback cannot be null.");

        callbackManager.addCustomEventCallback(event, callback);
    }
930434
public function on($event, \Closure $callback): void
    {
        // check if event is a single string and parse it to array single item
        if (!Any::isArray($event)) {
            $event = [$event];
        }
        
        foreach ($event as $item) {
            $this->events[$item][] = $callback;
        }
    }
492503
function addListener(event, callback) {
    checkEventValid(event);

    if (listeners[event]) {
        listeners[event].push(callback);
    } else {
        listeners[event] = [callback];
    }
}
17293
public void addEvent(Event event) {
        if(event == null)
            throw new IllegalStateException("event must be non-null");

        if(logger.isTraceEnabled())
            logger.trace("Adding event " + event);

        eventQueue.add(event);
    }