From 1fda7ad94c331836ffe2f9c359eb1dd1063e070d Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 2 Nov 2015 15:22:21 +0100 Subject: [PATCH] Add comment about file list only JS scripts --- developer_manual/app/js.rst | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/developer_manual/app/js.rst b/developer_manual/app/js.rst index 1c7d783a8..a968b9e39 100644 --- a/developer_manual/app/js.rst +++ b/developer_manual/app/js.rst @@ -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 `_. A nice tutorial screencast collection can be found on `Egghead.io `_ +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 + + 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 ======================