Question

I'm using yepnope together with jQuery Address. In some yepnope calls, some files to be retrieved may already be loaded previously. However when that happens yepnope doesn't fire the complete or callback. How should i fix this?

yepnope({
load: ['/js_scripts/jquery.selectbox-0.2.min.js','/js_scripts/jquery-ui-1.10.0.custom.min.js','/js_scripts/jquery.ba-throttle-debounce.min.js','/css/jquery-ui-1.8.23.custom.css','/js_scripts/search.js'],
    callback: {
        "search.js": function () {
            doSearch();
        }
    }
});

So basically i want it to work the same way as Query.getScript does. Always do the callback whether the retrieved file is downloaded or was already cached. Or maybe i should just use getScript?

Was it helpful?

Solution

Fixed it by using LABjs instead. Through LABjs i can do:

$LAB
.script('/js_scripts/jquery.selectbox-0.2.min.js','/js_scripts/jquery-ui-1.10.0.custom.min.js','/js_scripts/jquery.ba-throttle-debounce.min.js','/js_scripts/search.js')
.wait(function(){ // wait for all scripts to execute first
    doSearch();
});

and it will always load. http://labjs.com/documentation.php

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top