public function build($selector, $function, ...$params)
    {
        $attributes = [];


        foreach($params as $p) {
            $attributes[] = $this->encode($p);
        }

        //n concatenation du json
        $attributes =  implode(',', $attributes);

        // gestion des functions
        $attributes = preg_replace('#\"(function\([^\{]+{.*\})\",#', '$1,', $attributes);

        return sprintf('$("%s").%s(%s);', $selector, $function, $attributes);
    }