Repository navigation
Event for background tab reloads (in addition to UrlEnter) #276
Closed
poslat-pismo
started this conversation in
Feature requests / ideas
Replies: 1 comment 1 reply
|
Hello, appreciate the love for glide :)
Yeah the intention for
This approach using glide.autocmds.create("ConfigLoaded", async () => {
const tab = await browser.tabs.create({ url: "https://example.com" });
const target_tab_id = tab.id!;
if (window.__interval_id != null) {
clearInterval(window.__interval_id);
}
window.__interval_id = setInterval(() => {
browser.tabs.reload(target_tab_id);
}, 3000);
browser.tabs.onUpdated.addListener((tab_id, change_info, tab) => {
if (tab_id === target_tab_id && change_info.status === "complete") {
console.log("Tab finished loading:", tab.url);
}
});
}); |
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Hi,
First of all, thank you for Glide – I really enjoy using it and experimenting with some small automations.
I’m currently trying to implement a simple polling script that checks a static page for new messages every 3 minutes and shows a browser notification if there are any. The basic idea was:
A simplified version of what I’m doing:
However, I realized that
UrlEnterdoes not fire when the tab is in the background (not active), so this pattern does not work reliably for passive monitoring of a page.Would it be possible to add an event that also triggers on reloads for background tabs, something like a
TabReload(or equivalent), or alternatively makeUrlEnterfire on reload even when the tab is not active? That would make it much easier to implement lightweight polling/notification workflows like the one above without having to rely onsetIntervalin the browser context.If there is already a recommended way to handle this scenario with the current API, I would really appreciate any pointers as well.
Thank you for your time and for considering this request.
All reactions