jimhigson / oboe.js

A streaming approach to JSON. Oboe.js speeds up web applications by providing parsed objects before the response completes.
http://jimhigson.github.io/oboe.js-website/index.html
Other
4.79k stars 208 forks source link

Question: Regarding offline state #179

Open dkaushik95 opened 6 years ago

dkaushik95 commented 6 years ago

Is there any way to stop the fetching process in oboe when the internet is not available? I am using react native and when my internet goes off, I am stuck in a loading state forever.

dkaushik95 commented 6 years ago

Here is a sample code

loading = true
error = false
oboe(url)
.node('!.*', data => {
  insertData(data)
})
.start(status => {
  loading = false
})
.done( res => {
 loading = false
})
.fail(error => {
 loading = false
 error = true
})