0.0.4 • Published 9 years ago

@nathanfaucett/xmlhttprequest_polyfill v0.0.4

Weekly downloads
1
License
MIT
Repository
github
Last release
9 years ago

xmlhttprequest_polyfill

xmlhttprequest polyfill for the browser

var XMLHttpRequestPolyfill = require("@nathanfaucett/xmlhttprequest_polyfill");


var xhr = new XMLHttpRequestPolyfill();


xhr.open("GET", "/test", true);

xhr.setRequestHeader("Content-Type", "application/json");

xhr.getRequestHeader("Content-Type") === "application/json";
xhr.getRequestHeaders() === {
    "Content-Type": "application/json"
};

xhr.addEventListener("readystatechange", function(e) {
    e.type === "readystatechange";
});
xhr.addEventListener("progress", function(e) {
    e.type === "progress";
});
xhr.addEventListener("loadstart", function(e) {
    e.type === "loadstart";
});
xhr.addEventListener("load", function(e) {
    e.type === "load";
});
xhr.addEventListener("loadend", function() {
    xhr.status === 404;
});

xhr.send(null);