SlexAxton / yepnope.js

A Script Loader For Your Conditional Builds
http://yepnopejs.com/
BSD 3-Clause "New" or "Revised" License
2.51k stars 323 forks source link

Sometimes 'complete()' fires before file has executed. #208

Closed ultimatedelman closed 10 years ago

ultimatedelman commented 10 years ago

It doesn't happen all the time, but when it does, it breaks my app. Every so often I will do something like (I use Modernizr):

Modernizr.load({
   // has object been loaded somewhere?
   test: !!Namespace.ObjectToLoad
   // if not, load this file
   , nope: locationOfFile
   // if it exists already or when done loading, run this function
   , complete: function() {
        var myObj = new Namespace.ObjectToLoad.init(); // <---- error: undefined is not a function
   }
});

I can't use this library if I can't rely on complete() firing consistently, which sucks, because I use it for everything.

jaypea commented 10 years ago

i've experience the same problem :/