Frontend\Core\Engine\Base\Widget::addJS PHP Method

addJS() public method

Add a javascript file into the array
public addJS ( string $file, boolean $overwritePath = false, boolean $minify = true )
$file string The path to the javascript-file that should be loaded.
$overwritePath boolean Whether or not to add the module to this path. Module path is added by default.
$minify boolean Should the file be minified?
    public function addJS($file, $overwritePath = false, $minify = true)
    {
        $file = (string) $file;
        $overwritePath = (bool) $overwritePath;
        // use module path
        if (!$overwritePath) {
            $file = '/src/Frontend/Modules/' . $this->getModule() . '/Js/' . $file;
        }
        // add js to the header
        $this->header->addJS($file, $minify);
    }