I am using RequireJS for AMD. Using this code, I execute my function after loading module1:
require(['module1'], function (module1) {
if (module1) {
}
);
In some cases, module1unavailable (mainly due to access security). I want to handle what happens if the module1download fails. Using some code:
require(['module1'], function (module1) {
if (module1) {
}
)
.fail(function(message)
{
console.log('error while loading module: ' + message);
}
or maybe the require function accepts another parameter for module loading failures?
So, the question is, how can I handle it if I could not load the required module?
source
share