To make the timeout "infinite" I use this:
fetch (serverUrl)
.then
( resp => resp.json()
)
.then
( json => $cback (json)
)
.catch
( e => $cback (e)
);
The '$cback' is an in-scope visible callback-function
which detects if it's 1st argument is an instanceof
Error. If so it will make a new call to fetch().
If it does NOT detect it is an error it uses the
response for whatever it was intended, and then
makes a new call to fetch.
This seems to work great on FireFox. The fetch does
not timeout which is what I want. Unfortunately
on Chrome fetch() ALWAYS times out in about 2 minutes
That causes the catch-clause to fire, in other words
the timeout is seen as an error. But I catch it.
The real problem for me on Chrome is that even
though I catch the error it still produces an
error-entry in the log about the no-response-request.
So if users leave their browser open before going
to lunch they will see many error-messages in their
browser-log (if they care to look) and I'm afraid
the number of errors there will cause them to
"freak out".