Merge pull request #1861 from owncloud/filelist-only-js-scripts

Add comment about file list only JS scripts
This commit is contained in:
Morris Jobke
2015-11-03 12:54:22 +01:00

View File

@@ -18,7 +18,18 @@ The JavaScript files reside in the **js/** folder and should be included in the
// add vendor files (also allows the array syntax)
vendor_script('myapp', 'script'); // adds vendor/script.js
The recommended JavaScript framework to use is `AngularJS <https://angularjs.org/#>`_. A nice tutorial screencast collection can be found on `Egghead.io <https://egghead.io/technologies/angularjs>`_
If the script file is only needed when the file list is displayed, you should
listen to the ``OCA\Files::loadAdditionalScripts`` event:
.. code-block:: php
<?php
$eventDispatcher = \OC::$server->getEventDispatcher();
$eventDispatcher->addListener('OCA\Files::loadAdditionalScripts', function() {
script('myapp', 'script'); // adds js/script.js
vendor_script('myapp', 'script'); // adds vendor/script.js
});
Sending the CSRF token
======================