---
sidebar_position: 0
---

# debug

The `sos.debug` API groups together methods for checking the state of remote debug mode.

:::note
- This debug is not the "native debug" of the device, but rather a remote debug mode that allows you to connect to the device using Weinre.
- State of the remote debug mode or native debug mode can be changed via Cloud Control or [Rest API](https://developers-staging.signageos.io/api/#tag/DeviceDebug/paths/~1v1~1device~1%7BdeviceUid%7D~1debug/put).
:::

## Methods

### isRemoteDebugEnabled()

The `isRemoteDebugEnabled()` method returns the state of the Device debug mode.

```ts expandable
isRemoteDebugEnabled(): Promise<boolean>;
```

#### Return value

Resolves to `true` if the remote debug mode is enabled, otherwise `false`.

<Separator />

### onRemoteDebugChanged()

The `onRemoteDebugChanged()` method sets up a listener, which is called whenever the state of the Device debug mode is changed.

```ts expandable
onRemoteDebugChanged(listener: (data: {
    enabled: boolean;
}) => void): void;
```

#### Params

| Name       | Type                                    | Required         | Description                                                                   |
|------------|-----------------------------------------|------------------|-------------------------------------------------------------------------------|
| `listener` | `(data: { enabled: boolean; }) => void` |  <div>Yes</div>  | The listener to be called when the state of the remote debug mode is changed. |

#### Return value

Resolves when the listener is successfully set up.

## API Example

```ts
import { sos } from '@signageos/front-applet';

void sos.onReady(async () => {
	if (await sos.debug.isRemoteDebugEnabled()) {
		console.log('Remote debug is turned on');
	}

	sos.debug.onRemoteDebugChanged((enabled) => {
		console.log('Weinre debug is', { enabled });
	});
});

```