# API

**Kind**: interface | **Module**: [Platform](https://docs.interop.io/desktop/reference/javascript/platform/index.md) | **Access**: `io.platform`

**Source**: https://docs.interop.io/desktop/reference/javascript/platform/api/index.html

Platform API.

## Methods

### onShuttingDown

Notifies when the io.Connect platform is about to be shut down or restarted.

```ts
(callback: (args: ShuttingDownEventArgs) => Promise<{ prevent: boolean }>) => UnsubscribeFunction
```

**Parameters**

- **`callback`** (`(args: ShuttingDownEventArgs) => Promise<{ prevent: boolean }>`, required)
  Callback function for handling the event. You can use this callback to execute custom code
  before the platform shuts down or restarts. The available time for the execution of your code is 60 seconds.
  To prevent the platform shutdown or restart, the callback must resolve with an object with a `prevent` property set to `true`.

**Returns**: `UnsubscribeFunction`

### restart

Restarts the io.Connect platform.

```ts
(options?: ExitOptions) => Promise<void>
```

**Parameters**

- **`options`** (`ExitOptions`, optional)
  Settings for the restart operation.

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

### shutdown

Shuts down the io.Connect platform.

```ts
(options?: ExitOptions) => Promise<void>
```

**Parameters**

- **`options`** (`ExitOptions`, optional)
  Settings for the shutdown operation.

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

## Related types

- [ExitOptions](https://docs.interop.io/desktop/reference/javascript/platform/exitoptions/index.md)
- [ShuttingDownEventArgs](https://docs.interop.io/desktop/reference/javascript/platform/shuttingdowneventargs/index.md)
- [UnsubscribeFunction](https://docs.interop.io/desktop/reference/javascript/search/unsubscribefunction/index.md)
