cujojs / curl

curl.js is small, fast, extensible module loader that handles AMD, CommonJS Modules/1.1, CSS, HTML/text, and legacy scripts.
https://github.com/cujojs/curl/wiki
Other
1.89k stars 216 forks source link

Simoultaneous script loading issue #168

Closed adrianmiu closed 11 years ago

adrianmiu commented 11 years ago

I have the following situation

curl(['js!file1.js!order', 'js!file2.js!order', 'js!file3.js!order', function() { console.log ('set 1 loaded'); });

curl(['js!file2.js!order', 'js!file3.js!order', 'js!file4.js!order', function() { console.log ('set 2 loaded'); });

Both loading commands are executed immediately one after the other but only one of the callbacks is called. Is this a limitation of curljs or I'm doing something wrong?

unscriptable commented 11 years ago

Are you sure all of the files are loading and parsing? Try hooking up some error handlers.

curl(['js!file1.js!order', 'js!file2.js!order', 'js!file3.js!order'], function() { 
    console.log ('set 1 loaded');
}, function() { 
    console.log ('set 1 failed');
});

curl(['js!file2.js!order', 'js!file3.js!order', 'js!file4.js!order'], function() { 
    console.log ('set 2 loaded');
}, function() { 
    console.log ('set 2 failed');
});

-- John

adrianmiu commented 11 years ago

Sorry about raising this issue. I was working with 2 jquery plugins and one of them was overwritting some stuff and was breaking the previously loaded plugin which looked like it wasn't loaded. I'm using curl.js as a resource loader for my Feaxures JS project http://www.feaxures.com/example/curl.html

unscriptable commented 11 years ago

Neat! Looks cool!

Fwiw, it is possible to detect IE load/parse errors in curl.js via the !exports= suffix in the js! plugin. Post a question on https://groups.google.com/d/forum/cujojs or find us on #cujojs on freenode. :)

-- John