require

includes and caches a JS/CSS module(s)

promise require(string|array|object url, [function callback,object master] );
url
string|array|objectthe path to a JS/CSS file(s) callback
functionoptional, a callback function master
objectoptional, the value to be passed as the this parameter
promisea "promise" object

Example

webix.require("extras.js"); // "extras.css"

Details

The method is called only once. If you try to include the same module the second time, the command will be ignored.

To include several JS/CSS files, you can provide an array or an object as the first parameter of the method:

// including several files as an array
webix.require([
  "file1.js",
  "file2.js"
], function(){ /*callback*/ });
 
// including several files as an object
webix.require({
  "file1.js": true,
  "file2.js": true
}, function(){ /*callback*/ });

The difference between these two ways is the following:

Back to top
Join Our Forum
We've retired comments here. Visit our forum for faster technical support, connect with other developers, and share your feedback there.