Merge pull request #865 from ajaxorg/worker
fix for loading of files generated by r.js from the worker
This commit is contained in:
commit
718abf10a7
2 changed files with 7 additions and 1 deletions
|
|
@ -35,8 +35,8 @@ var require = function(parentId, id) {
|
|||
var module = require.modules[id];
|
||||
if (module) {
|
||||
if (!module.initialized) {
|
||||
module.exports = module.factory().exports;
|
||||
module.initialized = true;
|
||||
module.exports = module.factory().exports;
|
||||
}
|
||||
return module.exports;
|
||||
}
|
||||
|
|
@ -56,6 +56,10 @@ require.tlns = {};
|
|||
var define = function(id, deps, factory) {
|
||||
if (arguments.length == 2) {
|
||||
factory = deps;
|
||||
if (typeof id != "string") {
|
||||
deps = id;
|
||||
id = require.id;
|
||||
}
|
||||
} else if (arguments.length == 1) {
|
||||
factory = id;
|
||||
id = require.id;
|
||||
|
|
|
|||
|
|
@ -114,6 +114,8 @@ var WorkerClient = function(topLevelNamespaces, mod, classname) {
|
|||
oop.implement(this, EventEmitter);
|
||||
|
||||
this.$normalizePath = function(path) {
|
||||
if (!location.host) // needed for file:// protocol
|
||||
return path;
|
||||
path = path.replace(/^[a-z]+:\/\/[^\/]+/, ""); // Remove domain name and rebuild it
|
||||
path = location.protocol + "//" + location.host
|
||||
// paths starting with a slash are relative to the root (host)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue