Connection helper
The helper that turns detect() into UI state: connection flag, one-time connect, and a simple request surface.
Best for
Safe UI gating, install banners, and pages that should react cleanly to connection state.
Load with
RTO_form_api.js first.
Works well with
RTO_tabsList.js, RTO_visible_when_tab.js, and the status UI pattern.
Summary
Connection helper: detect + global flag + stable request API.
- Exports:
RTOconnectOnce,RTOconnected,RTOConnector.request() - Depends on:
RTO_form_api.js
What it is
Detects the extension (via RTOForm.detect()) and sets window.RTOconnected.
Also exposes a stable call wrapper: window.RTOConnector.request({ "action": "...", ... }).
Friendly actions: open, focus, close (mapped to openTab, focusTab, closeTab).
Download
Download RTO_connector.jsExample
<script src="../RTO_helpers/RTO_form_api.js"></script>
<script src="../RTO_helpers/RTO_connector.js"></script>
<script>
RTOconnectOnce(1500).then(function(ok){
console.log("connected?", ok, "flag:", window.RTOconnected);
if(!ok) return;
RTOConnector.request({
action: "open",
tabKey: "demo",
url: "https://example.com",
focus: true,
newTab: true
}).then(function(res){
console.log("openTab result:", res);
});
});
</script>