Created
July 30, 2015 10:03
-
-
Save hgl/6778051c1386dde04ecc 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
// cancel request | |
let req = new Request(url); | |
fetch(req).catch(() => { | |
// reject with abort error | |
}); | |
req.abort(); // abort fetch | |
// cancel stream reading | |
fetch(url).then(r => { | |
r.abort(); | |
return r.json(); | |
}).catch(() => { | |
// reject with abort error | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment