mirror of
https://github.com/Hopiu/jquery-mobile.git
synced 2026-04-02 14:00:22 +00:00
Changed reloadLib to use requirejs' context. That process being async it now returns a $.Deferred
This commit is contained in:
parent
1e965041c1
commit
94587acda2
1 changed files with 11 additions and 6 deletions
|
|
@ -56,19 +56,24 @@
|
|||
reloads: {},
|
||||
|
||||
reloadLib: function(libName){
|
||||
var deferred = $.Deferred();
|
||||
if(this.reloads[libName] === undefined) {
|
||||
this.reloads[libName] = {
|
||||
lib: $("script[src$='" + libName + "']"),
|
||||
count: 0
|
||||
};
|
||||
}
|
||||
|
||||
var lib = this.reloads[libName].lib.clone(),
|
||||
src = lib.attr('src');
|
||||
require(
|
||||
{
|
||||
baseUrl: "../../../js",
|
||||
context: libName+"_"+this.reloads[libName].count++
|
||||
}, [libName],
|
||||
function() {
|
||||
deferred.resolve();
|
||||
}
|
||||
);
|
||||
|
||||
//NOTE append "cache breaker" to force reload
|
||||
lib.attr('src', src + "?" + this.reloads[libName].count++);
|
||||
$("body").append(lib);
|
||||
return deferred;
|
||||
},
|
||||
|
||||
rerunQunit: function(){
|
||||
|
|
|
|||
Loading…
Reference in a new issue