Add a processor function of type function(data,callback)
162591
function addProcessor(eventType, processor) {
    if (processors[eventType]===undefined)
      processors[eventType] = [];
    processors[eventType].push(processor);
  }
1025727
def add_callback(self, name, func):
        

        if name not in self.callbacks:
            raise ValueError("Unknown callback name: %s" % name)

        self.callbacks[name].add(func)
335459
def async_call(func, *args, callback=None):
    '''
    '''
    def do_call():
        result = None
        error = None

        try:
            result = func(*args)
        except Exception:
            error = traceback.format_exc()
            logger.error(error)
        if callback:
            GLib.idle_add(callback, result, error)

    thread = threading.Thread(target=do_call)
    thread.daemon = True
    thread.start()
97546
def add_thread(self, func, interval):
        
        t = Thread(func, interval, self.output_dict)
        t.start()
        self._thread_pool.append(t)
354562
function callbackify(func) {
  return function(...args) {
    if (args.length === 0
        || typeof args[args.length - 1] !== 'function') {
      throw new Error(`${func.name || 'Function'} requires a callback.`);
    }

    const callback = args.pop();

    func.call(this, ...args).then((value) => {
      setImmediate(() => callback(null, value));
    }, (err) => {
      setImmediate(() => callback(err));
    });
  };
}
877661
def __add_callback(self, type_, func, serialised_if_crud=True):
        """"""
        Validation.callable_check(func)
        with self.__callbacks:
            self.__callbacks[type_].append((func, serialised_if_crud))
153666
def insert(self, index, function, update=True):
        
        self._funcs.insert(index, function)
        self._add_dep(function)
        if update:
            self._update()
359939
def add_callback(self, func):
        
        if func is None: return
        func_list = to_list(func)

        if not hasattr(self, 'callback_list'):
            self.callback_list = func_list
        else:
            self.callback_list.extend(func_list)
850619
function(type, data){
            var listeners = _cache[type],len = 0;
            if(!$.isUndefined(listeners)){
                var args = [].slice.call(arguments, 0);
                args = args.length > 2 ? args.splice(2, args.length-1) : [];
                args = [data].concat(args);

                len = listeners.length;
                for(var i = 0; i<len;i++){
                    var listener = listeners[i];
                    if(listener && listener.callback) {
                        args = args.concat(listener.args);
                        listener.callback.apply(listener.scope, args);
                    }
                }
            }
            return this;
        }
1305530
function add() {
            if (list) {
                // First, we save the current length
                var start = list.length;
                (function add(args) {
                    var doEach = function doEach(arg) {
                        var type = checkType(arg);
                        if (type === "function") {
                            if (!options.unique || !self.has(arg)) {
                                list.push(arg);
                            }
                        } else if (arg && arg.length && type !== "string") {
                            // Inspect recursively
                            add(arg);
                        }
                    };
                    if (Array.isArray(args)) {
                        args.forEach(doEach);
                    } else {
                        for (var k in args) {
                            doEach(args[k]);
                        }
                    }
                })(arguments);
                // Do we need to add the callbacks to the
                // current firing batch?
                if (firing) {
                    firingLength = list.length;
                    // With memory, if we're not firing then
                    // we should call right away
                } else if (memory) {
                        firingStart = start;
                        fire(memory);
                    }
            }
            return this;
        }
961349
function(processors) {
        var that = this;
        _.each(processors, function(processor, name) {
            if (name in that._processors) {
                throw new Error('Processor "' + name + '" already exists!');
            }
            that._processors[name] = processor;
        });

        return this;
    }
683565
function run(desc, data, callback) {
    if (callback.length === 2) {
        callItAsync(desc, data, callback)
    } else {
        callItSync(desc, data, callback)
    }
}
781052
def register(self, event_type: str,
                 **data_detail: Any) -> Callable[[AsyncCallback], AsyncCallback]:
        """"""
        def decorator(func: AsyncCallback) -> AsyncCallback:
            self.add(func, event_type, **data_detail)
            return func
        return decorator
169518
function() {
        if (process.platform !== 'win32') {
            return;
        }

        this._cpuConsole = child_process.spawn('typeperf', ['\\Processor(_Total)\\% Processor Time']);
        this._cpuConsole.stdout.on('data', _.bind(function(stdout) {

            stdout = stdout.toString();
            if (stdout && stdout.indexOf(',') === 0) {
                var cpu = parseFloat(stdout.substr(2, stdout.length - 3));
                this._cpuFrame(cpu);
            }
        }, this));
    }
538642
def add_function(self,
                     fun=None,
                     name=None,
                     fun_type=FUN_TYPE):
        """"""
        if not name:
            if six.PY2:
                name = fun.func_name
            else:
                name = fun.__name__

        self.say('adding fun(%s)' % name, verbosity=50)
        self.say('adding fun_type:%s' % fun_type, verbosity=50)

        if self.function_exists(name):
            self.cry('overwriting :fun(%s)' % name, verbosity=10)

        self.say('added :' + name, verbosity=10)
        self._rule_functions[name] = RuleFunction(name, fun, fun_type)
        return True
69010
def add_callback(self, callback, *callback_args, **callback_kwargs):
        """"""
        return self.add_callbacks(callback, callback_args=callback_args,
                           callback_kwargs=callback_kwargs)
610886
public function addProcessor($callback, $processBufferRecord = false)
    {
        if (!is_callable($callback) && !$this->isInstanceOf($callback, ProcessorInterface::class)) {
            throw new \InvalidArgumentException('Processor must be valid callable or an instance of ' . ProcessorInterface::class);
        }

        if ($processBufferRecord) {
            $this->bufferProcessors->prepend($callback);
        } else {
            $this->processors->prepend($callback);
        }


        return $this;
    }