Events

React to tab changes (open/close/navigate) without polling everywhere.
Docs updated: 2025-12-17

tabStatus events

The extension can send events about controlled tabs. RTO_form_api.js provides a simple subscription:

<script src="../RTO_helpers/RTO_form_api.js"></script>
<script>
  // Receive updates from the extension about tab state changes
  RTOForm.onTabStatus(function(ev){
    // Typical shape: { type:'tabStatus', tabKey:'...', status:'open'|'closed'|..., url:'...' }
    console.log("tab status:", ev);
  });
</script>

Beginner usage

  • Use events to refresh your tab list UI.
  • Use events to disable buttons when a tab is closed.
  • If you do not want events, you can poll with RTOTabsList.requestNow().

Helper: visible_when_tab

RTO_visible_when_tab.js is a small UI helper built on tab state. It can show/hide elements based on whether a tabKey is currently open.

<!-- Show/hide a section when a tabKey is open -->
<section
  data-rto-visible-when="tab-open"
  data-rto-visible-tabKey="billing"
  style="display:none"
>
  Billing tab is open ✅
</section>

<script src="../RTO_helpers/RTO_connector.js"></script>
<script src="../RTO_helpers/RTO_visible_when_tab.js"></script>

Next