carto/browser/require.js
2013-08-28 11:52:18 +02:00

24 lines
436 B
JavaScript

//
// Stub out `require` in the browser
//
window.carto = window.carto || {};
window.carto.underscore = window._;
function require(arg) {
var mod = window.carto[arg];
if(!mod) {
mod = window.carto[arg.split('/')[1]];
}
if(!mod) {
mod = window.carto[arg]
}
if(!mod) {
mod = window[arg.split('/')[1]];
}
// try global scope
if(!mod) {
mod = window[arg]
}
return mod;
}