Push callback which will be called only once, when writing is available next time
@param  callable $cb Callback
@return void
961623
public function onWriteOnce($cb)
    {
        if (!$this->writing) {
            $cb($this);
            return;
        }
        $this->onWriteOnce->push($cb);
    }
1024141
public function hook($hookName, $cb) {
		$args = [$hookName, $cb];
		return call_user_func_array([$this->getHookManager(), 'hook'], $args);
	}
3770
public function transition(callable $cb)
    {
        $where = $this->where;

        $data = $this->get();

        if (call_user_func_array($cb, [$data]) === true) {
            $this->where = $where;
        }

        return $this;
    }
1367293
protected function pushWriteContext(Context $c)
    {
        $this->writeContextStack_[] = $this->writeContext_;
        $this->writeContext_ = $c;
    }
641889
public function publish($chan, $cb, $opcb = null)
    {
        $this->redis->publish($this->config->redisprefix->value . $chan, $cb, $opcb);
    }
456737
public function addListener($cb)
    {
        if ($this->state === self::STATE_DONE) {
            $cb($this);
            return;
        }
        $this->listeners[] = CallbackWrapper::wrap($cb);
    }
826584
public function once(string $eventName, callable $callBack, int $priority = 100)
    {
        $wrapper = null;
        $wrapper = function () use ($eventName, $callBack, &$wrapper) {
            $this->removeListener($eventName, $wrapper);

            return \call_user_func_array($callBack, \func_get_args());
        };

        $this->on($eventName, $wrapper, $priority);
    }
620811
public function sendFrame($data, $type = 0x00, $cb = null)
    {
        if ($this->finished) {
            return false;
        }
        $this->framesBuffer[] = $data;
        if ($cb !== null) {
            $this->onWrite->push($cb);
        }
        $this->flush();
        return true;
    }
89035
public static function sync($cb = null, $pri = EIO_PRI_DEFAULT)
    {
        $cb = CallbackWrapper::forceWrap($cb);
        if (!self::$supported) {
            if ($cb) {
                $cb(false);
            }
            return false;
        }
        return eio_sync($pri, $cb);
    }
7370
public static function wrap($cb, $timeout = null, $ctx = false)
    {
        if ($cb instanceof CallbackWrapper || ((Daemon::$context === null) && ($timeout === null))) {
            return $cb;
        }
        if ($cb === null) {
            return null;
        }
        return new static($cb, $timeout, $ctx !== false ? $ctx : Daemon::$context);
    }
196586
public function logout($cb = null)
    {
        if ($cb) {
            $this->onResponse->push($cb);
        }
        $this->writeln(self::TAG_LOGOUT . " LOGOUT");
    }
38359
public function setkey($key, $value, $cb = null)
    {
        $this->redis->set($this->config->redisprefix->value . $key, $value, $cb);
    }
985500
public function writeChunkToFd($fd, $cb = null)
    {
        return false; // It is not supported yet (callback missing in EventBuffer->write())
        if (!$this->curChunkSize) {
            return false;
        }
        $this->write($fd, $this->curChunkSize);
        $this->curChunkSize = null;
        return true;
    }
61737
public function addListener($cb)
    {
        if ($this->state === self::STATE_DONE) {
            if ($cb !== null) {
                $cb($this);
            }
            return;
        }
        if ($cb !== null) {
            $this->listeners->push($cb);
        }
        if ($this->state === self::STATE_WAITING) {
            $i = 1;
            $n = func_num_args();
            while ($i < $n) {
                $this->args[] = func_get_arg($i);
                ++$i;
            }
            $this->state = self::STATE_RUNNING;
            $func = $this->producer;
            $func($this);
        }
    }
1044611
def make_call_with_cb(self, fun, *args):
        """"""

        cid, event = self.handler.register_callback()
        argscp = list(args)
        argscp.append(cid)
        self.make_call(fun, *argscp)
        return event
48513
public function requestPlayers($cb)
    {
        $this->request('challenge', null, function ($conn, $result) use ($cb) {
            if (is_array($result)) {
                $cb($conn, $result);
                return;
            }
            $conn->request('players', $result, $cb);
        });
    }
798424
public function prefix($prefix, callable $cb)
    {
        $prefix = rtrim($prefix, '/');

        if (!preg_match('@^/@', $prefix)) {
            $prefix = '/' . $prefix;
        }

        if ($this->prefix !== null) {
            $this->prefix .= $prefix;
        } else {
            $this->prefix = $prefix;
        }

        call_user_func_array($cb, [$this]);

        $this->prefix = '';

        return $this;
    }