nameToUrl is renamed to toUrl in requirejs 2

This commit is contained in:
nightwing 2012-06-06 18:49:05 +04:00
commit a230c15950

View file

@ -56,14 +56,17 @@ var WorkerClient = function(topLevelNamespaces, packagedJs, mod, classname) {
workerUrl = require.nameToUrl("ace/worker/worker_sourcemint"); workerUrl = require.nameToUrl("ace/worker/worker_sourcemint");
} else { } else {
// We are running in RequireJS. // We are running in RequireJS.
workerUrl = this.$normalizePath(require.nameToUrl("ace/worker/worker", null, "_")); // nameToUrl is renamed to toUrl in requirejs 2
if (require.nameToUrl && !require.toUrl)
require.toUrl = require.nameToUrl;
workerUrl = this.$normalizePath(require.toUrl("ace/worker/worker", null, "_"));
} }
this.$worker = new Worker(workerUrl); this.$worker = new Worker(workerUrl);
var tlns = {}; var tlns = {};
for (var i=0; i<topLevelNamespaces.length; i++) { for (var i=0; i<topLevelNamespaces.length; i++) {
var ns = topLevelNamespaces[i]; var ns = topLevelNamespaces[i];
var path = this.$normalizePath(require.nameToUrl(ns, null, "_").replace(/.js$/, "")); var path = this.$normalizePath(require.toUrl(ns, null, "_").replace(/.js$/, ""));
tlns[ns] = path; tlns[ns] = path;
} }