Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The module ID of the custom JS file is 'configbox/custom/custom'. Use this typical structure to make the custom.js an AMD module:

Code Block
languagephpjs
define(['cbj'], function($) {
	// return an object if you have a use for it in other modules.
	// In the example we require jQuery, you'll have it as $ in your module. See below for more info on jQuery and plugins.
});

...

This sample is your custom.js file. Assume you have a module file called module1.js in your customisation directory already.

Code Block
languagephpjs
define(['configbox/custom/module1'], function(module1) {
	
});

...

We use jQuery 3 and upgrade jQuery regularly. We made strict isolation of 'our' jQuery from any jQuery library loaded in your CMS. Our jQuery does not write itself to the global scope and defines itself anonymously. To get a reference to jQuery, use this code

Code Block
languagephpjs
cbrequire(['cbj'], function($) {
	// Do stuff with $
});

...