2
我正在使用requirejs加載javascript模塊。
有沒有辦法在所有模塊加載時觸發事件?
如果是,如何?如何觸發所有模塊都加載requireJs
我正在使用requirejs加載javascript模塊。
有沒有辦法在所有模塊加載時觸發事件?
如果是,如何?如何觸發所有模塊都加載requireJs
由於taken from the API,你可以回調添加到主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);
}