jRequire

jRequire is meant for developers wanting to use AMD-style JavaScript development. We encourage developers to bundle this extension with their extensions in the hope that it serves as a standard way of integrating require.js in Joomla.

So how to use it?

With library and plugin installed you make a call like this:

Jrequire::addModuleCall($moduleId, $method);

$moduleId is the path to your AMD module. Say you have a JS file in

/media/com_example/js/example.js

then your $moduleId is media/com_example/js/example.

$method is the name of a method in your AMD module. Once the JS is loaded, the method gets called. You can leave $method empty if you just want to load the module.

Other infos

  • We use require.js 2.3.5 and update shortly after any updates
  • We dual-license: you choose to get a copy under the MIT or GPLv3 license.

Download version 1.0.0