Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reload at fixed time intervals #10

Open
reasonlogic opened this issue Jan 12, 2017 · 15 comments
Open

Reload at fixed time intervals #10

reasonlogic opened this issue Jan 12, 2017 · 15 comments
Labels

Comments

@reasonlogic
Copy link

Mohammed, a neat little extension. Well done. I would find it even more useful if automatically reloaded every N (say 5, 10, 30, 60, 300) minutes, rather than needing to manually click the button.

@mohamedmansour
Copy link
Owner

@reasonlogic what would be a good UI to introduce this?

@reasonlogic
Copy link
Author

reasonlogic commented Jan 28, 2017 via email

@bondjw07
Copy link

bondjw07 commented Feb 1, 2019

+1 for this. Looks like you have the only extension out there that reloads all tabs, all I need now is for it to work on a schedule! Would love to see that implemented.

@mohamedmansour
Copy link
Owner

Let me ask the designer who is working with me to figure out the best UX for this @erensong if you have ideas let us know

@mohamedmansour
Copy link
Owner

mohamedmansour commented Feb 1, 2019

@bondjw07 two thought processes:

we could introduce a pop up, when you click on it, it opens a detailed view letting the user figure out what to do with reloading. It could have an optional option to specify the reloading interval. You click on it again, you can cancel that schedule.

I think that would be ideal and be friendly to many scenarios!

@erensong can you help with designing this?

I am in a middle of reimplementing many extensions so it would be better :) with webpack and such.

I can invest more time in 10 days, currently on vacation with no PC

@mohamedmansour mohamedmansour added in development In development for next release design needed Design and UX needed labels Feb 1, 2019
@mohamedmansour
Copy link
Owner

Closing #20 in favor of this design

@leao-nardo
Copy link

@reasonlogic what would be a good UI to introduce this?

the simpler way i see to do this is :
to put this option in the right click menu as like "auto-reload tab in set interval"
then when clicked a poup-up or alert open and the user type the interval he wants in minutes

@mohamedmansour
Copy link
Owner

@reasonlogic what would be a good UI to introduce this?

the simpler way i see to do this is :
to put this option in the right click menu as like "auto-reload tab in set interval"
then when clicked a poup-up or alert open and the user type the interval he wants in minutes

I made this extension more secure by removing as much permissions as I can, to be minimal. For example, adding a popup inline in the webpage is not allowed anymore otherwise I have to expand permissions to "read browsing data".

I think a better approach might be creating a UI for the extension popup, right now it is a default action, I think I can make a small hack to enable this so that if the user wants to enable "interval" updates, I can make it work. This will be a bit tricky since tabs need to be tracked in case user deletes that tab, but it is easy.

@mohamedmansour mohamedmansour removed the in development In development for next release label May 3, 2021
@leao-nardo
Copy link

leao-nardo commented May 3, 2021

i don't see the need for UI or poup-ups . just an alert can be enough.
the user click "set interval" entry in the menu > then alert open > user type the interval ex.: 5 ,10 ,60 and enter > done

@mohamedmansour
Copy link
Owner

@leao-nardo an alert is not possible cause I didn't give that permission to this extension cause it means the extension can read history.

@sniemetz did a PR #38 which added context menus with custom intervals to refresh. I have updated the extension to Manifest V3 since Google requires all extension developers to do that. If you fetch the new code you will see it changed a bit.
Basically extensions should now be event driven via service worker due to new performance tweaks Chromium is doing. We can no longer use setInterval or setTimeout because the background script / service worker can die. So to make this work we need to leverage chrome.alarms API

When creating fixed intervals, I want to implement it with the right user experience. If a user wants to do fixed intervals, it would be nice to:

  1. See which tabs are currently reloading at some interval, and turn it off
  2. Set any time the user wants, even dynamic time (to bypass user behavior when websites block you due to botting)

We could solve the first one by modifying the context menu to have "currently run intevals" but that becomes messy because a context menu should only show what is relevant for that webpage not all webpages. For the second one, we could let the user define the time they want to refresh the page and then it will construct the menu dynamically that way, but that is tedious as well.

What I believe the right solution would be (would love to get your insights on this)

  1. Add a single entry to the context menu to "Refresh at a Fixed Interval"
  2. When the user clicks it, it will open a popup, or activate the existing popup if it exists. This popup will be the fixed time interval manager.
    3.That manager popup will manage all running intervals, such as stopping them, looking at how many times it was reloaded, and perhaps in the future, we can allow users to get notified when a specific section has changed.
  3. When that manager popup is closed, all intervals are stopped.

@leao-nardo
Copy link

that solution seems very good ,also more time comsuming as u say. maybe divide in baby steps would be good in the implementation like first doing the
1 Add a single entry to the context menu to "Refresh at a Fixed Interval" and put the interval in 5min like .,

then make the time editable
,>then make the poup-ups
then maybe adding those logs like how many times it was reloaded
then the get notified when change .

and about the permissions i think your project being with open source code and small it become less of a problem because the person can see and revise themselves . and you can also divide making a lightweight version and a complete version with more permissons.

@mohamedmansour
Copy link
Owner

@sniemetz I say the minimum refresh we support is 1 minute, via chrome.alarms API. On top of that, we should not fire more than one alarm every minute. That is unfortunately the limitation we have to live by.

I have added chrome.alarms to my other extension mohamedmansour/prayer-times-extension@dee9bbe and it works great as long as you schedule them in the future. I say we should not allow any alarm under 1 minute and we should only allow the minutes unit of measurement.

I believe Chrome throttles alarms too if you have to alarms in the same extension being fired, so we should be smarter. When registering an alarm on two websites, the data structure of setting it up should be an array, so "every minute, refresh these N sites" instead of firing N alarms, one for each site.

@mohamedmansour
Copy link
Owner

Another thing, after implementing this, the codebase will be double the size :) Which is not necessary bad, but we need to do some refactor. Hopefully soon, we can work on this: #42 so that we will have a better foundation and nicer codebase to work with.

@sniemetz
Copy link
Contributor

sniemetz commented May 13, 2021 via email

@sniemetz
Copy link
Contributor

sniemetz commented May 13, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants