# Instance

**Kind**: interface | **Module**: [App Management](https://docs.interop.io/desktop/reference/javascript/app%20management/index.md) | **Access**: `io.appManager.myInstance`

**Source**: https://docs.interop.io/desktop/reference/javascript/app management/instance/index.html

Describes an app instance.

## Properties

- **`application`** (`Application`, required)
  The app object of the instance.
- **`id`** (`string`, required)
  App instance ID.
- **`interopInstance`** (`IOConnectDesktop.Interop.Instance`, required)
  Access to the Interop instance. Use this to invoke Interop methods for the app instance.
- **`title`** (`string | undefined`, required)
  Title of the app instance.

## Methods

### activate

Activates the app instance.

```ts
() => Promise<IOConnectDesktop.Interop.InvocationResult<any>>
```

**Returns**: `Promise<IOConnectDesktop.Interop.InvocationResult<any>>`

### getContext

Retrieves the starting context of the instance.

```ts
() => Promise<Record<string, any>>
```

**Returns**: `Promise<Record<string, any>>`

### getWindow

Retrieves the window object corresponding to the app instance.

```ts
() => Promise<Windows.IOConnectWindow>
```

**Returns**: `Promise<Windows.IOConnectWindow>`

### onInteropReady

Notifies when the Interop library is ready to be used.

```ts
(callback: (instance: Instance) => any) => UnsubscribeFunction
```

**Parameters**

- **`callback`** (`(instance: Instance) => any`, required)
  Callback function for handling the event.

**Returns**: `UnsubscribeFunction`

### onStopped

Notifies when the instance is stopped.

```ts
(callback: (instance: Instance) => any) => UnsubscribeFunction
```

**Parameters**

- **`callback`** (`(instance: Instance) => any`, required)
  Callback function for handling the event.

**Returns**: `UnsubscribeFunction`

### startedBy

Retrieves information about how the current app instance was started, and about the identity of the initiator.

*Since: io.Connect Desktop 9.3, @interopio/desktop 6.3.1*

```ts
() => Promise<StartedByInfo>
```

**Returns**: `Promise<StartedByInfo>`

### stop

Stops the app instance.

```ts
() => Promise<void>
```

**Returns**: `Promise<void>`

## Related types

- [Application](https://docs.interop.io/desktop/reference/javascript/app%20management/application/index.md)
- [IOConnectWindow](https://docs.interop.io/desktop/reference/javascript/windows/ioconnectwindow/index.md)
- [InvocationResult](https://docs.interop.io/desktop/reference/javascript/interop/invocationresult/index.md)
- [StartedByInfo](https://docs.interop.io/desktop/reference/javascript/app%20management/startedbyinfo/index.md)
- [UnsubscribeFunction](https://docs.interop.io/desktop/reference/javascript/search/unsubscribefunction/index.md)
