Add ability to null asset broadcasting from AJAX

This commit is contained in:
Samuel Georges 2016-01-16 17:12:54 +11:00
parent f2699a7039
commit b65a653176
1 changed files with 11 additions and 0 deletions

View File

@ -28,6 +28,17 @@ trait AssetMaker
*/
public $assetPath;
/**
* Disables the use, and subequent broadcast, of assets. This is useful
* to call during an AJAX request to speed things up. This method works
* by specifically targeting the hasAssetsDefined method.
* @return void
*/
public function clearAssetDefinitions()
{
$this->assets = ['js'=>[], 'css'=>[], 'rss'=>[]];
}
/**
* Outputs <link> and <script> tags to load assets previously added with addJs and addCss method calls
* @param string $type Return an asset collection of a given type (css, rss, js) or null for all.