mirror of
https://github.com/liriliri/eruda.git
synced 2026-03-20 09:38:37 +08:00
Dev: Sources
This commit is contained in:
19
eustia/get.js
Normal file
19
eustia/get.js
Normal file
@@ -0,0 +1,19 @@
|
||||
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();
|
||||
}
|
||||
Reference in New Issue
Block a user