Note: @kitsonk (a core Deno dev) has published a TypeScript XMLHttpRequest
polyfill that may or may not suit your purposes better: https://deno.land/x/xhr@0.2.1 It seems to be ~actively maintained, unlike this repo, and you could strip types from it fairly easily if you need a pure JS module.
A buggy polyfill of XMLHttpRequest for Deno (and other browser and browser-like environments) by browserifying @driverdan/node-XMLHttpRequest.
import XMLHttpRequest from "https://deno.land/x/xmlhttprequest_deno@v0.0.2/mod.js";
let xhr = new XMLHttpRequest();
xhr.onreadystatechange = function() {
if(this.readyState == 4 && this.status == 200) {
console.log(this.responseText);
}
};
xhr.open("GET", "https://example.com", true);
xhr.send();
- Fix the major bugs mentioned here: