Skip to content
Browse files

AMD loader: support for module re-mapping (some modules have differen…

…t location)
  • Loading branch information...
1 parent 6df582e commit 49ac8ba90d00f3da08bd75285713e1246f0c1811 @janodvarko janodvarko committed Apr 3, 2012
Showing with 6 additions and 8 deletions.
  1. +6 −8 extension/modules/mini-require.js
View
14 extension/modules/mini-require.js
@@ -91,7 +91,8 @@ var Loader =
}
else
{
- this.load(module.scope, moduleId);
+ var moduleUrl = this.getModuleUrl(moduleId) + ".js";
+ require.load(module.scope, moduleId, moduleUrl);
}
this.currentModule.pop();
@@ -100,19 +101,15 @@ var Loader =
return module.exports;
},
- load: function(moduleScope, moduleId)
+ load: function(context, fullName, url)
{
- //xxxHonza: Remaping moved modules
-
- var moduleUrl = this.getModuleUrl(moduleId) + ".js";
-
try
{
- Services.scriptloader.loadSubScript(moduleUrl, moduleScope);
+ Services.scriptloader.loadSubScript(url, context);
}
catch (err)
{
- Cu.reportError(moduleId + " -> " + moduleUrl);
+ Cu.reportError(fullName + " -> " + url);
Cu.reportError(err);
}
},
@@ -158,6 +155,7 @@ var Loader =
require = Loader.require.bind(Loader);
define = Loader.define.bind(Loader);
+require.load = Loader.load.bind(Loader);
// ********************************************************************************************* //
})();

0 comments on commit 49ac8ba

Please sign in to comment.
Something went wrong with that request. Please try again.