Events
Listen to extension events posted to your page (tabStatus stream).
Docs updated: 2026-03-24
tabStatus
The extension can post a tabStatus event stream to your page via window.postMessage.
This is a one-way notification. It’s useful to refresh UI (tabs list, “connected” indicator),
or to wait until a controlled tab is ready (e.g. “complete”).
<script src="../RTO_helpers/RTO_form_api.js"></script>
<script>
// Helper-based subscription:
RTOForm.onStatus(function (d) {
// Typical shape (fields may vary by event):
// { "type":"tabStatus", "tabKey":"...", "tabId":123, "event":"loading"|"complete"|"url"|"activated"|"removed"|..., "url":"..." }
console.log("tabStatus:", d);
});
</script>
<script>
// Raw window.message listener:
window.addEventListener("message", function (ev) {
var d = ev && ev.data;
if (!d || typeof d !== "object") return;
// Filter by the extension origin marker:
if (d.origin !== "rto-extension") return;
if (d.type === "tabStatus") {
console.log("tabStatus:", d);
}
}, false);
</script>
Tip: you can filter the stream by
tabKey if you manage multiple controlled tabs.
Examples
Refresh a tabs list UI when status changes
<script src="../RTO_helpers/RTO_form_api.js"></script>
<script src="../RTO_helpers/RTO_tabsList.js"></script>
<script>
(function () {
function refresh() {
RTOTabsList.requestNow(2500);
}
// Refresh when the extension reports tab changes
RTOForm.onStatus(function () { refresh(); });
// Initial load
refresh();
})();
</script>
Wait until a controlled tab is fully loaded
<script src="../RTO_helpers/RTO_form_api.js"></script>
<script>
RTOForm.waitForStatus(function (ev) {
return ev && ev.type === "tabStatus" && ev.tabKey === "demo" && ev.event === "complete";
}, 15000).then(function (ev) {
console.log("demo tab ready:", ev);
});
</script>
Tips
- MV3: tab lifecycle events are emitted by the background, then forwarded to the page.
- Don’t block: treat
tabStatusas an async stream; always update UI non-blockingly. - Filter: if you manage multiple tabs, filter by
tabKeyand/ortabId.