josephrocca / XMLHttpRequest-deno

A polyfill of XMLHttpRequest for Deno (and other browser and browser-like environments) by browserifying @driverdan/node-XMLHttpRequest

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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.


XMLHttpRequest Deno Polyfill

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();

TODO

About

A polyfill of XMLHttpRequest for Deno (and other browser and browser-like environments) by browserifying @driverdan/node-XMLHttpRequest

License:MIT License


Languages

Language:JavaScript 100.0%