Dependencies added

This commit is contained in:
Luis Fernando Molina committed 2018-02-25 18:30:22 +01:00
1 parent 94aad2ea07
commit 39d9c0de99
64 files changed
+8665

No files matched your search

+34
View File
@@ -0,0 +1,34 @@
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);
this.close();
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);
this.close();
sys.puts("done");
}
};
xhr.open("GET", url, false);
xhr.send();
}