Abort previous pending XHR when navigating

This commit is contained in:
Robin North
2018-01-23 15:09:57 +00:00
parent 6000ad5620
commit 486ef0e0ba
8 changed files with 89 additions and 6 deletions

8
lib/abort-request.js Normal file
View File

@@ -0,0 +1,8 @@
var noop = require("./util/noop")
module.exports = function(request) {
if (request && request.readyState < 4) {
request.onreadystatechange = noop
request.abort()
}
}