Dev: Sources

This commit is contained in:
surunzi
2016-05-09 11:54:48 +08:00
parent 6f2b4b31c9
commit 18e2ff8910
8 changed files with 166 additions and 66 deletions

View File

@@ -457,6 +457,33 @@ module.exports = (function ()
return exports;
})({});
/* ------------------------------ get ------------------------------ */
var get = _.get = (function (exports)
{
function exports(url, cb)
{
var xhr = new window.XMLHttpRequest();
xhr.onload = function ()
{
var status = xhr.status;
if ((status >= 200 && status < 300) || status === 304)
{
cb(null, xhr.responseText);
}
};
xhr.onerror = function () { cb(xhr) };
xhr.open('GET', url);
xhr.send();
}
return exports;
})({});
/* ------------------------------ identity ------------------------------ */
var identity = _.identity = (function (exports)