denilsonsa / crx-reload-tab

Chrome extension to reload the current tab at a chosen interval.

Home Page:https://chrome.google.com/webstore/detail/knnahnemielbnanghaphjgheamgcjjcb

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Tab auto reloader (Chrome extension)

Donation - buy me a coffee

Chrome extension to reload the current tab at a chosen interval. Get it on Chrome Web Store!

Screenshot of this extension

Features:

  • Free and open-source.
  • No (extra) permissions required.
  • Easy-to-use.
  • The reload interval can be different for each tab.

The icon is a remix of public-domain cliparts stopwatch by markroth8 and Reload icon by mlampret.

Technical stuff

Persistent background page

This extension is implemented using a persistent background page. Ideally, it could have been an event page that only gets loaded when there is a tab being reloaded, and gets unloaded if no tabs are being auto-reloaded.

However, I could not find a way to keep an event page active. The documentation states that "The event page will not shut down until all message ports are closed.", but keeping a global Port object at the background page was not enough to prevent it from being suspended.

There is also the alarms API, but the minimum interval is one minute, which is unsuitable for the purposes of this extension.

If someone finds a better way to implement this extension, feel free to open an issue or send a pull request.

Icon badge and Chrome event listeners

The small text below the icon is called badge. When the badge text is set to a single tab, the badge gets reset whenever the tab loads another page (or reloads the same page).

For that reason, the extension adds a listener to chrome.tabs.onUpdated to restore the badge text after reloading.

In addition, the extension adds a listener to chrome.tabs.onRemoved to clear the reload whenever a tab gets closed.

The extension is smart enough to remove the listeners if no tab is being auto-reloaded.

About

Chrome extension to reload the current tab at a chosen interval.

https://chrome.google.com/webstore/detail/knnahnemielbnanghaphjgheamgcjjcb

License:MIT License


Languages

Language:JavaScript 78.1%Language:HTML 20.8%Language:Shell 1.1%