gi-nx / getAppPanels
ts
function getAppPanels(this: RpcCallContext): AppPanelState[];Where every panel this app has open currently sits, and whether the user can see it. rect is in host-viewport pixels; it is null while the panel is not laid out. active means the panel's tab is the selected one in its group, visible means it is also not hidden behind a maximized panel.
The same array is pushed on the appPanels state event whenever the layout changes, so prefer listening over polling.
Parameters
| Parameter | Type |
|---|---|
this | RpcCallContext |
Returns
One entry per open panel, keyed by the panelKey that openAppPanel returned. A panel the user closed is dropped from the list.
Example
typescript
import { giraffeState, rpc } from '@gi-nx/iframe-sdk';
const panels = await rpc.invoke('getAppPanels', []);
giraffeState.addListener(['appPanels'], () => {
const mine = giraffeState.get('appPanels').find(p => p.panelKey === panelKey);
if (!mine) return; // the user closed it
console.log(mine.visible, mine.rect);
});