---
name: "IpcPlayerContext.setAvailableRockerDirections"
mode: "api"
versionRequirements:
  - { name: "Base Library", version: "2.21.8" }
title: "IpcContext.setAvailableRockerDirections - 设置可用的摇杆方向"
---

## IpcPlayerContext.setAvailableRockerDirections

> [VERSION] Base Library >= 2.21.8

### Description

Set available joystick directions

### Parameters

`Params`

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `options` | `IpcSetRockerDirectionsOption` | No | Direction configuration |

### Return Value

None


### Referenced Types

##### `interface` IpcSetRockerDirectionsOption

| Property | Type | Description |
| --- | --- | --- |
| `left` | `number` | Whether the left direction is available: 0 = unavailable, 1 = available |
| `right` | `number` | Whether the right direction is available: 0 = unavailable, 1 = available |
| `top` | `number` | Whether the up direction is available: 0 = unavailable, 1 = available |
| `bottom` | `number` | Whether the down direction is available: 0 = unavailable, 1 = available |
| `success` | `() => void` | Callback invoked on successful API call |
| `fail` | `(result: IpcFailResult) => void` | Callback on failure |
| `complete` | `() => void` | Callback on complete (success or failure) |

##### `interface` IpcFailResult

| Property | Type | Description |
| --- | --- | --- |
| `errorCode` | `string` | Error code |
| `errorMsg` | `string` | Error message |


### Examples

#### Set joystick direction

```ts
const ipcCtx = ty.createIpcPlayerContext('deviceId');
ipcCtx.setAvailableRockerDirections({
  left: 1,
  right: 1,
  top: 1,
  bottom: 1,
  success() {
    console.log('Joystick directions set');
  },
});
```
