Update documentation to customize JavaScript
Note that, while it doesn't really affect the way the application behaves (as long as the JavaScript code doesn't rely on the order it's loaded) we're requiring `app/assets/javascripts/custom.js` after requiring any files in the `app/assets/javascripts/custom/` folder. This is done for consistency, since we load the content of `app/assets/javascripts/application.js` after requiring everything else.
This commit is contained in:
@@ -1,7 +1,23 @@
|
||||
// Overrides and adds customized javascripts in this file
|
||||
// Read more on documentation:
|
||||
// * English: https://github.com/consuldemocracy/consuldemocracy/blob/master/CUSTOMIZE_EN.md#javascript
|
||||
// * Spanish: https://github.com/consuldemocracy/consuldemocracy/blob/master/CUSTOMIZE_ES.md#javascript
|
||||
// Add calls to your custom JavaScript code using this file.
|
||||
//
|
||||
// We recommend creating your custom JavaScript code under the
|
||||
// `app/assets/javascripts/custom/` folder and calling it from here.
|
||||
//
|
||||
// See the `docs/en/customization/javascript.md` file for more information.
|
||||
|
||||
var initialize_modules = function() {
|
||||
"use strict";
|
||||
|
||||
// Add calls to your custom code here; this will be called when
|
||||
// loading a page.
|
||||
};
|
||||
|
||||
var destroy_non_idempotent_modules = function() {
|
||||
"use strict";
|
||||
|
||||
// Add calls to your custom code here when your JavaScript code added
|
||||
// in `initialize_modules` is not idempotent.
|
||||
};
|
||||
|
||||
$(document).on("turbolinks:load", initialize_modules);
|
||||
$(document).on("turbolinks:before-cache", destroy_non_idempotent_modules);
|
||||
|
||||
Reference in New Issue
Block a user