includes and caches a JS/CSS module(s)

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


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


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
], function(){ /*callback*/ });
// including several files as an object
  "file1.js": true,
  "file2.js": true
}, function(){ /*callback*/ });

The difference between these two ways is the following:

  • if the files are set in an array, the loading order is sequential: file2.js will be loaded after file1.js;
  • if the files are set in an object, all js files are loaded at the same time and preserving the order of loading is not guaranteed.
Back to top