Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/tfs/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何触发所有加载了requireJs的模块_Javascript_Require - Fatal编程技术网

Javascript 如何触发所有加载了requireJs的模块

Javascript 如何触发所有加载了requireJs的模块,javascript,require,Javascript,Require,我正在使用requirejs加载javascript模块。 是否有方法在加载所有模块时触发事件? 如果是,如何进行 As,您可以向主requirejs函数添加回调: requirejs(['jquery', 'canvas', 'app/sub'], callMe); // the second parameter is the callback function callMe($, canvas, sub) { console.log('everything is loaded');

我正在使用requirejs加载javascript模块。
是否有方法在加载所有模块时触发事件?
如果是,如何进行

As,您可以向主
requirejs
函数添加回调:

requirejs(['jquery', 'canvas', 'app/sub'], callMe); // the second parameter is the callback

function callMe($, canvas, sub) {
  console.log('everything is loaded');
   // the libraries are now available as parameters in the same sequence as in the array
  console.log('loaded', $, canvas, sub);
}