AJAX callback for the different campaigns.
171000
public function ajaxCallbackGenerateLiveScorecard($node) {
    $node = $this->entityTypeManager->getStorage('node')->load($node);
    $result = $this->campaignScorecardService->generateLiveScorecard($node);
    return new Response($this->renderer->render($result));
  }
725521
public void refreshCallback(ClientMapInfo info) {
		if (info != null) {
			// must be called before anything else !
			unitLength = info.getUnitLength();
			pixelLength = info.getPixelLength();
			graphics.setBackgroundColor(info.getBackgroundColor());
			featurePainter.setPointSelectStyle(new ShapeStyle(info.getPointSelectStyle()));
			featurePainter.setLineSelectStyle(new ShapeStyle(info.getLineSelectStyle()));
			featurePainter.setPolygonSelectStyle(new ShapeStyle(info.getPolygonSelectStyle()));
			if (graphics.isReady()) {
				setAddons();
			}

			for (final Layer<?> layer : mapModel.getLayers()) {
				layer.addLayerChangedHandler(new LayerChangedHandler() {

					public void onLabelChange(LayerLabeledEvent event) {
						render(layer, null, RenderStatus.ALL);
					}

					public void onVisibleChange(LayerShownEvent event) {
						render(layer, null, RenderStatus.ALL);
					}

				});

				layer.addLayerStyleChangedHandler(new LayerStyleChangedHandler() {

					public void onLayerStyleChange(LayerStyleChangeEvent event) {
						render(layer, null, RenderStatus.ALL);
					}
				});
			}
			for (final VectorLayer layer : mapModel.getVectorLayers()) {
				layer.addLayerFilteredHandler(new LayerFilteredHandler() {

					public void onFilterChange(LayerFilteredEvent event) {
						render(layer, null, RenderStatus.ALL);
					}
				});
			}
		}
	}
1158544
def on_change(self, *callbacks):
        ''' 

        '''
        for callback in callbacks:

            if callback in self._callbacks: continue

            _check_callback(callback, ('event',))

            self._callbacks[callback] = callback
1281326
def campaigns(options={})
      response = connection.get do |req|
      	req.url "campaigns", options
      end
      return_error_or_body(response)
  	end
887399
function(error, type, xhr, settings) {
		settings.error.call(settings.context, xhr, type, error);
		ajaxComplete(type, xhr, settings);
	}
116406
function () {

            var res = arguments[0];

            userOptions.emit('response', req, res);

            if (callback && userOptions.resCallback) callback.apply(this, arguments);

            res.on('end', function() {
                userOptions.emit('afterResponse', req, res);
            });

        }
990443
protected function callAfterCallbacks(Application $app)
    {
        foreach ($this->_afterCallbacks as $callback) {
            call_user_func($callback, $app);
        }
    }
649346
function ajax(url, options, callback, data, cache) {
  try {
    var x = new (XMLHttpRequest || ActiveXObject)('MSXML2.XMLHTTP.3.0');
    x.open(data ? 'POST' : 'GET', url, 1);
    if (!options.crossDomain) {
      x.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
    }
    if (options.authorize && options.apiKey) {
      x.setRequestHeader('Authorization', options.apiKey);
    }
    if (data || options.setContentTypeJSON) {
      x.setRequestHeader('Content-type', 'application/json');
    }
    x.onreadystatechange = function() {
      x.readyState > 3 && callback && callback(x.responseText, x);
    };
    x.send(JSON.stringify(data));
  } catch (e) {
    window.console && console.log(e);
  }
}
1231280
private function processRealTime()
    {
        if (!$this->realTime || !$this->campaign || !$this->contact) {
            return;
        }

        $this->campaignExecutioner->execute($this->campaign, [$this->contact->getId()]);
        $this->contactCampaigns[$this->campaign->getId()] = true;

        // Retrieve events fired by MauticContactClientBundle (if any)
        $events = $this->session->get('mautic.contactClient.events', []);
        if (!empty($events)) {
            $this->eventErrors = [];
            foreach ($events as $event) {
                if (isset($event['contactId']) && $event['contactId'] !== $this->contact->getId()) {
                    // For not ignore/exclude all events not relating to the current contact.
                    continue;
                }
                $this->events[] = $event;
                if (!empty($event['error'])) {
                    $eventName = !empty($event['name']) ? $event['name'] : '';
                    if (!is_array($event['errors'])) {
                        $event['errors'] = [$event['errors']];
                    }
                    $this->eventErrors[] = $eventName.' ('.$event['id'].'): '.implode(', ', $event['errors']);
                }
                if (isset($event['valid']) && $event['valid']) {
                    // One valid Contact Client was found to accept the lead.
                    $this->status = Stat::TYPE_ACCEPTED;
                    $this->valid  = true;
                    break;
                }
            }
        }

        // There was no accepted client hit, consider this a rejection.
        // @todo - This is highly dependent on the contact client plugin, thus should be made configurable, or we can make the realTime mode only available to those with both plugins.
        if (!$this->valid) {
            // If one or more clients were found, but none accepted.
            // This should be considered a rejected contact.
            $this->status = Stat::TYPE_REJECT;
        }

        // Apply scrub only to accepted contacts in real-time mode after evaluation.
        if ($this->valid && $this->isScrubbed()) {
            $this->status = Stat::TYPE_SCRUBBED;
            $this->valid  = false;
        }
    }
713761
function push(callback) {
  window.yandex_metrika_callbacks = window.yandex_metrika_callbacks || [];
  window.yandex_metrika_callbacks.push(callback);
}
51770
def __callbacks(self, msg):
            ''''''
            if self.callback:
                self.callback(msg, *self.callback_args, **self.callback_kwargs)
307652
public function sendCampaigns()
    {
        if ($this->jobHasAlreadyBeenRun('ddg_automation_campaign')) {
            $this->helper->log('Skipping ddg_automation_campaign job run');
            return;
        }

        $this->campaignFactory->create()->sendCampaigns();
    }
964154
function trigger(name, arg1, arg2, arg3, arg4) {
            // Common arguments for events
            switch (name) {
                case 'active':
                    arg2 = arg1;
                    arg1 = $items;
                    break;

                case 'activePage':
                    arg2 = arg1;
                    arg1 = pages;
                    break;

                default:
                    arg4 = arg1;
                    arg1 = pos;
                    arg2 = $items;
                    arg3 = rel;
            }

            if (callbacks[name]) {
                for (var i = 0, l = callbacks[name].length; i < l; i++) {
                    callbacks[name][i].call(frame, arg1, arg2, arg3, arg4);
                }
            }

            if (o.domEvents && !parallax) {
                $frame.trigger(pluginName + ':' + name, [arg1, arg2, arg3, arg4]);
            }
        }
884642
function(apps) {
			jQuery.each(apps, function(i, a) {
				if (_isPlaceholderElement(appConfigs[i].root)) {
					jQuery(appConfigs[i].root)
						.addClass(F2.Constants.Css.APP)
						.append(jQuery(a.html).addClass(F2.Constants.Css.APP_CONTAINER + ' ' + appConfigs[i].appId));
				}
				else if (!_bUsesAppHandlers) {
					// load html and save the root node
					appConfigs[i].root = _afterAppRender(appConfigs[i], _appRender(appConfigs[i], a.html));
				}
				else {
					F2.AppHandlers.__trigger(
						_sAppHandlerToken,
						F2.Constants.AppHandlers.APP_RENDER,
						appConfigs[i], // the app config
						_outerHtml(jQuery(a.html).addClass(F2.Constants.Css.APP_CONTAINER + ' ' + appConfigs[i].appId))
					);

					var appId = appConfigs[i].appId,
						root = appConfigs[i].root;

					if (!root) {
						throw ('Root for ' + appId + ' must be a native DOM element and cannot be null or undefined. Check your AppHandler callbacks to ensure you have set App root to a native DOM element.');
					}

					if (!elementInDocument(root)) {
						throw ('App root for ' + appId + ' was not appended to the DOM. Check your AppHandler callbacks to ensure you have rendered the app root to the DOM.');
					}

					F2.AppHandlers.__trigger(
						_sAppHandlerToken,
						F2.Constants.AppHandlers.APP_RENDER_AFTER,
						appConfigs[i] // the app config
					);

					if (!F2.isNativeDOMNode(root)) {
						throw ('App root for ' + appId + ' must be a native DOM element. Check your AppHandler callbacks to ensure you have set app root to a native DOM element.');
					}
				}

				// init events
				_initAppEvents(appConfigs[i]);
			});
		}
798981
def msg_callback(self, callback):
        """"""
        if callable(callback):
            self._msg_callback = callback
        else:
            self._msg_callback = None
700157
def on_any_event(self, event):
        """"""
        if os.path.isfile(event.src_path):
            self.callback(event.src_path, **self.kwargs)
245507
protected function registerRequestCallback()
    {
        $this->swoolePort->on('Request', function ($request, $response) {
            $this->dispatchEvent('Request', $this->server, $this, $request, $response);
        });
    }