# CurrentLayoutAPI

**Kind**: interface | **Module**: [Layouts](https://docs.interop.io/desktop/reference/javascript/layouts/index.md) | **Access**: `io.v2.current`

**Source**: https://docs.interop.io/desktop/reference/javascript/layouts/currentlayoutapi/index.html

API for retrieving and tracking the currently active Global Layout.

## Methods

### get

Retrieves the state of the currently active Global Layout. Resolves with `null` if there isn't a currently active Global Layout.

```ts
() => Promise<CurrentLayoutState | null>
```

**Returns**: `Promise<CurrentLayoutState | null>`

### onChanged

Notifies when a different Global Layout becomes the current one, or when there is no longer a current Global Layout. Resolves with an unsubscribe function.

```ts
(handler: (state: CurrentLayoutState | null) => void) => Promise<UnsubscribeFunction>
```

**Parameters**

- **`handler`** (`(state: CurrentLayoutState | null) => void`, required)
  Callback function for handling the event. Receives the state of the current Global Layout, or `null`.

**Returns**: `Promise<UnsubscribeFunction>`

### onModified

Notifies when the current Global Layout is modified (e.g., an app has been started or closed). Resolves with an unsubscribe function.

```ts
(handler: (event: LayoutModifiedEvent) => void) => Promise<UnsubscribeFunction>
```

**Parameters**

- **`handler`** (`(event: LayoutModifiedEvent) => void`, required)
  Callback function for handling the event.

**Returns**: `Promise<UnsubscribeFunction>`

## Related types

- [CurrentLayoutState](https://docs.interop.io/desktop/reference/javascript/layouts/currentlayoutstate/index.md)
- [LayoutModifiedEvent](https://docs.interop.io/desktop/reference/javascript/layouts/layoutmodifiedevent/index.md)
- [UnsubscribeFunction](https://docs.interop.io/desktop/reference/javascript/layouts/unsubscribefunction/index.md)
