Thanks for this article. I would like to propose a little fix.
Try to do next:
Add your Example with Polling on the page.
Reload the page and switch a browser tab before your sample will be reloaded.
Wait until your page with sample will be reloaded.
Go back to your page.
You will see that poller calls console.log twice as often.
Try to stop the poller. It will work even after poller.stop() call.
This is due to double call of the poller.start. For the first time from your sample code. The second time you call it from the onVisibilityChange. There was no poller.stop method call between double poller.start method call in this case.
You can avoid it by calling the poller.stop method before the poller.start in the onVisibilityChange.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Thanks for this article. I would like to propose a little fix.
Try to do next:
Example with Polling
on the page.poller
callsconsole.log
twice as often.poller
. It will work even afterpoller.stop()
call.This is due to double call of the
poller.start
. For the first time from your sample code. The second time you call it from theonVisibilityChange
. There was nopoller.stop
method call between doublepoller.start
method call in this case.You can avoid it by calling the
poller.stop
method before thepoller.start
in theonVisibilityChange
.