/** * @param $params * @throws \Nette\InvalidStateException */ public function handleRemote($params) { if (!is_callable($this->remote)) { throw new Nette\InvalidStateException('Undefined Typehad callback.'); } $q = array_key_exists('q', $params) ? $params['q'] : NULL; // call remote function with displayed key and query $this->presenter->sendJson(Nette\Utils\Callback::invokeArgs($this->remote, [$this->display, $q])); }