Ask and ye shall receive: https://trac.cakephp.org/changeset/3047
JavascriptHelper::cacheEvents now supports caching all JavaScript code
written with JavascriptHelper, but it also supports outputting the code
to an external file and embedding a <script> tag in your page to link
to it (note: your webroot/js/ folder must be writeable by your web
server).
By putting this at the top of your action:
<?php $javascript->cacheEvents(true); ?>
all JavaScript events will be written to an external file. You can
change it to:
<?php $javascript->cacheEvents(true, true); ?>
to write all JavaScript code to an external file.
It's important to note that this will not work for any pages loaded via
Ajax, so we need a way to disable the external caching when the page is
loaded through an Ajax call. If you use the RequestHandler component,
just add this to your controller:
$this->set('isAjax', $this->RequestHandler->isAjax());
Then, you can change the code above to:
<?php $javascript->cacheEvents(!$isAjax, true); ?>
This new feature will show up in the nightlies sometime in the next few
days, or if you can't wait, you can get it in the 1.0 sandbox. I look
forward to everyone's feedback and input on this.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~----------~----~----~----~------~----~------~--~---