protected function generateFunction(array $config, array $params)
	{
		// returnFalse() and returnTrue() can be used as-is
		if ($config['js'] == 'returnFalse' || $config['js'] == 'returnTrue')
		{
			return new Code((string) $config['js']);
		}

		// Add an empty list of params if none is set
		$config += ['params' => []];

		$src  = $this->getHeader($params);
		$src .= 'function(' . implode(',', array_keys($params)) . '){';
		$src .= 'return ' . $this->parenthesizeCallback($config['js']);
		$src .= '(' . $this->buildCallbackArguments($config['params'], $params) . ');}';

		return new Code($src);
	}