d3 / d3-request

A convenient alternative to XMLHttpRequest.
BSD 3-Clause "New" or "Revised" License
110 stars 54 forks source link

Add Node support via xmlhttprequest. #8

Closed mbostock closed 8 years ago

mbostock commented 8 years ago

Related mbostock/d3#2736, we could use xmlhttprequest to add support for Node. Though, I’m not sure yet exactly how we express that dependency for Rollup so that it doesn’t affect non-CommonJS environments and Browserify.

mbostock commented 8 years ago

This seemed to work:

var Xhr = typeof XMLHttpRequest === "function"
    ? XMLHttpRequest
    : require("xmlhttprequest").XMLHttpRequest;

Though, d3.html doesn’t work, since it would also require a jsdom dependency and a global document.