Skip to content

Commit 7599803

Browse files
damenchoclaude
andcommitted
feat: Expose Jitsi iFrame API instances on window for console access
Adds window.jitsiApi (shortcut to last registered tab) and window.jitsiApis (map of all active tabs by ID) so developers can control participants directly from the browser console without needing the UI. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent d0a9bdc commit 7599803

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

src/contexts/TabsContext.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,10 @@ export const TabsProvider: React.FC<TabsProviderProps> = ({ children }) => {
244244
newApis.set(tabId, api);
245245
return newApis;
246246
});
247+
// Expose APIs on window for browser console access
248+
(window as any).jitsiApis = (window as any).jitsiApis || {};
249+
(window as any).jitsiApis[tabId] = api;
250+
(window as any).jitsiApi = api; // always points to the most recently registered tab
247251
}, []);
248252

249253
const unregisterTabApi = useCallback((tabId: string) => {
@@ -252,6 +256,12 @@ export const TabsProvider: React.FC<TabsProviderProps> = ({ children }) => {
252256
newApis.delete(tabId);
253257
return newApis;
254258
});
259+
if ((window as any).jitsiApis) {
260+
delete (window as any).jitsiApis[tabId];
261+
// Update jitsiApi shortcut to another active tab if available
262+
const remaining = Object.values((window as any).jitsiApis);
263+
(window as any).jitsiApi = remaining.length > 0 ? remaining[remaining.length - 1] : null;
264+
}
255265
}, []);
256266

257267
const getTabApi = useCallback((tabId: string) => {

0 commit comments

Comments
 (0)