abhutan1/Amazon-Whole-Foods-Delivery-Slots-Finder

Stops refreshing once switched to a new browser window

Closed this issue · 5 comments

Hey there,

Thanks for developing such a life saver!
I got an issue however.
The extension works fine when just started or I switch focus to other programs.
But it stops working once I switched to a new browser window.

Btw I'm using Windows.
Thanks for reading!

Thanks for the feedback @tpysz5n. Glad that you found this useful.

This isn't a bug actually. The extension works through toggle and is the same across different browser windows. So for instance, if you kick it off from window 1, toggling the extension again in window 2 will stop the process.

Thanks for getting back.
The thing is I never toggled the extension again in window 2.
I kicked it off from window 1, minimized it as you suggest, opened window 2 to continue browsing, then observed that window 1 stopped refreshing.
I'm not familiar with js so if you don't mind me asking, does this line window.location.reload(true) still work when the window is not in focus?
Much appreciated :)

Hey - you were right. I fixed this issue. Thanks for flagging it. I needed to inject the scripts into the original tab (from where the extension was kicked off) using the same tab id.

Re: window.location.reload(true) still work when the window is not in focus?

I am not an expert with js either but from what I found online, it seems like it should work? especially since the extension purposely injects code every 60 seconds into the same tab to force run the content scripts.

Ah yes it now works like a charm! Thank you and stay safe!

Thank you. You too. Take care!