public function js($asset = '', $extension = null, $attributes = array())
	{
		$extension = $extension ?: $this->detectExtensionName();

		$attr = array_merge(array(
			'type'  => 'text/javascript',
			'defer' => false,
			'async' => false
		), $attributes);

		$asset = new Javascript($extension, $asset);

		$asset = $this->isSuperGroupAsset($asset);

		if ($asset->exists())
		{
			if ($asset->isDeclaration())
			{
				\App::get('document')->addScriptDeclaration($asset->contents());
			}
			else
			{
				\App::get('document')->addScript($asset->link(), $attr['type'], $attr['defer'], $attr['async']);
			}
		}

		return $this;
	}
public function js($asset = '', $extension = null, $attributes = array())
	{
		$extension = $extension ?: $this->detectExtensionName();

		$attr = array_merge(array(
			'type'  => 'text/javascript',
			'defer' => false,
			'async' => false
		), $attributes);

		$asset = new Javascript($extension, $asset);

		$asset = $this->isSuperGroupAsset($asset);

		if ($asset->exists())
		{
			if ($asset->isDeclaration())
			{
				\App::get('document')->addScriptDeclaration($asset->contents());
			}
			else
			{
				\App::get('document')->addScript($asset->link(), $attr['type'], $attr['defer'], $attr['async']);
			}
		}

		return $this;
	}
public function js ( $ asset = '' , $ extension = null , $ attributes = array ( ) ) { $ extension = $ extension ? : $ this -> detectExtensionName ( ) ; $ attr = array_merge ( array ( 'type' => 'text/javascript' , 'defer' => false , 'async' => false ) , $ attributes ) ; $ asset = new Javascript ( $ extension , $ asset ) ; $ asset = $ this -> isSuperGroupAsset ( $ asset ) ; if ( $ asset -> exists ( ) ) { if ( $ asset -> isDeclaration ( ) ) { \ App :: get ( 'document' ) -> addScriptDeclaration ( $ asset -> contents ( ) ) ; } else { \ App :: get ( 'document' ) -> addScript ( $ asset -> link ( ) , $ attr [ 'type' ] , $ attr [ 'defer' ] , $ attr [ 'async' ] ) ; } } return $ this ; }
Push JS to the document

@param   string  $asset       Script to add
@param   string  $extension   Extension name, e.g.: com_example, mod_example, plg_example_test
@param   array   $attributes  Attributes
@return  object
Push JS to the document