Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added @jrburke's version of reloadModule that undefines the module in…

… RequireJS's cache so we can reload it
  • Loading branch information...
commit d04054b6fddffc62b0ef5125dac27d5450ef75ba 1 parent 7c7e6f2
Ghislain Seguin gseguin authored
Showing with 10 additions and 3 deletions.
  1. +10 −3 tests/jquery.testHelper.js
13 tests/jquery.testHelper.js
View
@@ -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();
Please sign in to comment.
Something went wrong with that request. Please try again.