清空
This commit is contained in:
1 parent
7c2ab0b7ad
commit
cff33ad7d1
6370 files changed
+378844
-82245
No files matched your search
+32
@@ -0,0 +1,32 @@
|
||||
var sys = require("util")
|
||||
, assert = require("assert")
|
||||
, XMLHttpRequest = require("../lib/XMLHttpRequest").XMLHttpRequest
|
||||
, xhr;
|
||||
|
||||
xhr = new XMLHttpRequest();
|
||||
|
||||
xhr.onreadystatechange = function() {
|
||||
if (this.readyState == 4) {
|
||||
assert.equal("Hello World", this.responseText);
|
||||
runSync();
|
||||
}
|
||||
};
|
||||
|
||||
// Async
|
||||
var url = "file://" + __dirname + "/testdata.txt";
|
||||
xhr.open("GET", url);
|
||||
xhr.send();
|
||||
|
||||
// Sync
|
||||
var runSync = function() {
|
||||
xhr = new XMLHttpRequest();
|
||||
|
||||
xhr.onreadystatechange = function() {
|
||||
if (this.readyState == 4) {
|
||||
assert.equal("Hello World", this.responseText);
|
||||
console.log("done");
|
||||
}
|
||||
};
|
||||
xhr.open("GET", url, false);
|
||||
xhr.send();
|
||||
}
|
||||
Reference in new issue
Block a user