mirror of
https://github.com/Hopiu/jquery-mobile.git
synced 2026-03-16 22:10:25 +00:00
Added @jrburke's version of reloadModule that undefines the module in RequireJS's cache so we can reload it
This commit is contained in:
parent
7c7e6f2578
commit
d04054b6fd
1 changed files with 10 additions and 3 deletions
|
|
@ -52,17 +52,24 @@
|
|||
reloads: {},
|
||||
|
||||
reloadModule: function(libName){
|
||||
var deferred = $.Deferred();
|
||||
var deferred = $.Deferred(),
|
||||
context;
|
||||
if(this.reloads[libName] === undefined) {
|
||||
this.reloads[libName] = {
|
||||
count: 0
|
||||
};
|
||||
}
|
||||
|
||||
//Clear internal cache of module inside of require
|
||||
context = require.s.contexts._;
|
||||
delete context.defined[libName];
|
||||
delete context.specified[libName];
|
||||
delete context.loaded[libName];
|
||||
delete context.urlFetched[require.toUrl(libName + '.js')];
|
||||
|
||||
require(
|
||||
{
|
||||
baseUrl: "../../../js",
|
||||
context: libName+"_"+this.reloads[libName].count++
|
||||
baseUrl: "../../../js"
|
||||
}, [libName],
|
||||
function() {
|
||||
deferred.resolve();
|
||||
|
|
|
|||
Loading…
Reference in a new issue