-
-
Save mbostock/b11689abe3db2fb7d90f90e5eb81a8b5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<meta charset="utf-8"> | |
<script src="//d3js.org/d3.v4.0.0-rc.2.min.js"></script> | |
<script> | |
// This fails without an error because it fails synchronously, | |
// and the error handler isn’t registered until AFTER the request is sent. | |
d3.request("invalid:///url") | |
.on("load", function() { console.log("1 loaded"); }) | |
.post() | |
.on("error", function() { console.log("1 errored"); }); | |
// If you register before the sending the request, you’ll see the error. | |
d3.request("invalid:///url") | |
.on("load", function() { console.log("2 loaded"); }) | |
.on("error", function() { console.log("2 errored"); }) | |
.post(); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment