basket.js icon indicating copy to clipboard operation
basket.js copied to clipboard

caching problem?

Open ray007 opened this issue 9 years ago • 3 comments

I'm trying to use basket.js to load the script for our application. The first try, when nothing is cached yet, looks fine. On reload I get an error when trying to access $.mobile.activePage (from jquery.mobile). Funnily enough, that seems to happen in all Windows Desktop browsers, but not in Safari (MacOS and iOS) so far. Any idea what's could have gone wrong here?

ray007 avatar Nov 26 '15 16:11 ray007

Update: it seems I found a workaround for the problem.

Originally I had a line $(document).ready(app.init); in my application, which I changed to initializing at the end of the loader:

basket.require(jsfiles)
.then(function() {
    app.init();
});

After changing the call app.init(); to asynchronous, things seem to be working again...

ray007 avatar Dec 01 '15 10:12 ray007

Yeah, document.ready will fire already when all "traditionally" loaded scripts are loaded. So this one should probably be closed?

OMantere avatar Dec 15 '15 16:12 OMantere

Not really, in the then-clause of a Promise I shouldn't need to make my call asynchronous to make it work. Maybe just a problem of an old RSVP version?

ray007 avatar Dec 15 '15 17:12 ray007