fix for loading of files generated by r.js from the worker
This commit is contained in:
parent
61aa47bc85
commit
94ea9a5845
2 changed files with 9 additions and 0 deletions
|
|
@ -56,6 +56,10 @@ require.tlns = {};
|
||||||
var define = function(id, deps, factory) {
|
var define = function(id, deps, factory) {
|
||||||
if (arguments.length == 2) {
|
if (arguments.length == 2) {
|
||||||
factory = deps;
|
factory = deps;
|
||||||
|
if (typeof id != "string") {
|
||||||
|
deps = id;
|
||||||
|
id = require.id;
|
||||||
|
}
|
||||||
} else if (arguments.length == 1) {
|
} else if (arguments.length == 1) {
|
||||||
factory = id;
|
factory = id;
|
||||||
id = require.id;
|
id = require.id;
|
||||||
|
|
@ -135,4 +139,7 @@ onmessage = function(e) {
|
||||||
else if (msg.event && sender) {
|
else if (msg.event && sender) {
|
||||||
sender._emit(msg.event, msg.data);
|
sender._emit(msg.event, msg.data);
|
||||||
}
|
}
|
||||||
|
if (msg.eval) {
|
||||||
|
console.log(eval(msg.eval));
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -114,6 +114,8 @@ var WorkerClient = function(topLevelNamespaces, mod, classname) {
|
||||||
oop.implement(this, EventEmitter);
|
oop.implement(this, EventEmitter);
|
||||||
|
|
||||||
this.$normalizePath = function(path) {
|
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 = path.replace(/^[a-z]+:\/\/[^\/]+/, ""); // Remove domain name and rebuild it
|
||||||
path = location.protocol + "//" + location.host
|
path = location.protocol + "//" + location.host
|
||||||
// paths starting with a slash are relative to the root (host)
|
// paths starting with a slash are relative to the root (host)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue