make Ace compatible with requireJS 0.25.0. This
expects a "data-main" to be present. fix #345
This commit is contained in:
parent
df27d13b94
commit
b28fb5cabc
5 changed files with 1917 additions and 2143 deletions
|
|
@ -49,13 +49,16 @@ var WorkerClient = function(topLevelNamespaces, packagedJs, module, classname) {
|
|||
var worker = this.$worker = new Worker(base + packagedJs);
|
||||
}
|
||||
else {
|
||||
var workerUrl = require.nameToUrl("ace/worker/worker", null, "_");
|
||||
var workerUrl = this.$normalizePath(require.nameToUrl("ace/worker/worker", null, "_"));
|
||||
var worker = this.$worker = new Worker(workerUrl);
|
||||
|
||||
var tlns = {};
|
||||
for (var i=0; i<topLevelNamespaces.length; i++) {
|
||||
var ns = topLevelNamespaces[i];
|
||||
tlns[ns] = require.nameToUrl(ns, null, "_").replace(/.js$/, "");
|
||||
var path = this.$normalizePath(require.nameToUrl(ns, null, "_").replace(/.js$/, ""));
|
||||
|
||||
tlns[ns] = path;
|
||||
console.log(ns, tlns[ns], require)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -100,6 +103,12 @@ var WorkerClient = function(topLevelNamespaces, packagedJs, module, classname) {
|
|||
|
||||
oop.implement(this, EventEmitter);
|
||||
|
||||
this.$normalizePath = function(path) {
|
||||
if (!path.match(/^\w+:/))
|
||||
path = location.protocol + "//" + location.host + location.pathname + "/" + path;
|
||||
return path;
|
||||
};
|
||||
|
||||
this.$guessBasePath = function() {
|
||||
if (require.aceBaseUrl)
|
||||
return require.aceBaseUrl;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue