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

addJS() public method

Add a javascript file into the array
public addJS ( string $file, boolean $overwritePath = false, boolean $minify = true, boolean $addTimestamp = null )
$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?
$addTimestamp boolean May we add a timestamp for caching purposes?
    public function addJS($file, $overwritePath = false, $minify = true, $addTimestamp = null)
    {
        $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, $addTimestamp);
    }