Caret/js/util/text.js

20 lines
381 B
JavaScript
Raw Normal View History

2013-12-16 19:29:41 +00:00
define(function() {
var cache = {};
return {
load: function(name, parentRequire, onLoad, config) {
if (name in cache) {
return onLoad(cache[name]);
}
var xhr = new XMLHttpRequest();
xhr.open("GET", name);
xhr.onload = xhr.onerror = function() {
onLoad(xhr.responseText);
}
xhr.send();
}
};
});