HubSpot / offline

Automatically display online/offline indication to your users
http://github.hubspot.com/offline/docs/welcome
MIT License
8.67k stars 849 forks source link

Offline.options #271

Open ktapdasan opened 6 years ago

ktapdasan commented 6 years ago

I am getting this error.

SyntaxError: missing ) in parenthetical

On reconnect: { initialDelay: 3, delay: (1.5 * last delay, capped at 1 hour) }

schroef commented 6 years ago

They seem to have missed to add proper name. last delay is never declared? I tried adding the var initialDelay which was right above that but get an error that is not declared.

mfkp commented 6 years ago

I think that's supposed to be a comment or something. Should probably look like this:

delay: 3 // if null, default is (1.5 * last delay, capped at 1 hour), otherwise specify integer seconds

I just browsed through the source and it looks like it works like this:

If you don't set these options, it will default to a initialDelay of 3, and each time it tries to reconnect, it will multiply the delay by 1.5 (exponential decay).

If you do set the initialDelay and delay options, then it will be a static number of seconds each delay (example, if delay is set to 3, then it will re-check every 3 seconds until reconnected).

schroef commented 6 years ago

Ahh oke, ill try that. On the other hand, im wondering if this even does anything. Because when you get connecting while its still counting down, it will go online immediately. Thus that makes that count and delay and useless.

EDIT well i tried couple methods using it with initialDelay above it, without it. Also setting different numbers to delay. Makes no difference, it keeps starting at 10 and countdown.