public function registerDecorator($name, $decorator)
    {
        if (is_object($name)) {
            $this->registerJavascriptObject('decorator', $this->wrapDecoratorObject($name));
        } elseif ($decorator === false) {
            $this->registerJavascriptObject('decorator', $name);
        } elseif (is_callable($decorator)) {
            $this->registerJavascriptFunction('decorator', $name, $this->wrapDecoratorCallable($name, $decorator));
        } else {
            $this->registerJavascriptFunction('decorator', $name, $decorator);
        }
    }