network.js icon indicating copy to clipboard operation
network.js copied to clipboard

Add XHR error handling for offline

Open bradgreens opened this issue 9 years ago • 0 comments

My use case is if the browser becomes offline and the XHR requests begin to error, my JS app continues to run and watch for online availability.

This adds a hook to push null into the latency array if the XHR request responded with the error event, allowing the net.latency.on( 'end' ) callback to receive null information and conclude there is no connection. Not sure if these needs to accommodate for intentional server errors, but it's an improvement in my case.

bradgreens avatar Oct 04 '16 18:10 bradgreens