compatibility with dojo.require
This commit is contained in:
parent
5eca7dd820
commit
3cc878f4c1
1 changed files with 5 additions and 5 deletions
|
|
@ -41,17 +41,17 @@
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
|
|
||||||
var globalRequire = require;
|
var globalRequire = typeof require != "undefined" && require;
|
||||||
|
|
||||||
define(function (require, exports, module) {
|
define(function (require, exports, module) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
exports.load = function (name, req, onLoad, config) {
|
exports.load = function (name, req, onLoad, config) {
|
||||||
if (req.isBrowser)
|
|
||||||
require("ace/lib/net").get(req.toUrl(name), onLoad);
|
|
||||||
else
|
|
||||||
//Using special require.nodeRequire, something added by r.js.
|
//Using special require.nodeRequire, something added by r.js.
|
||||||
onLoad(globalRequire.nodeRequire('fs').readFileSync(req.toUrl(name), 'utf8'));
|
if (globalRequire && globalRequire.nodeRequire)
|
||||||
|
onLoad(('fs').readFileSync(req.toUrl(name), 'utf8'));
|
||||||
|
else
|
||||||
|
require("ace/lib/net").get(req.toUrl(name), onLoad);
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue