---
name: "handleShortcut"
mode: "kit"
versionRequirements:
  - { name: "BizKit", version: "3.1.1" }
  - { name: "@ray-js/ray", version: "0.8.0" }
platform:
  - "iOS"
  - "Android"
async: true
---

## handleShortcut

> [VERSION] BizKit >= 3.1.1 | @ray-js/ray >= 0.8.0

> [PLATFORM] iOS, Android

> ⚡ **Supports Promise** — Returns a Promise when success / fail / complete callbacks are omitted.

### Description

Manage shortcuts, including add and remove, iOS only

### Parameters

| Property | Type | Required | Default | Since | Description |
| --- | --- | --- | --- | --- | --- |
| `type` | `number` | Yes | - | `3.1.1` | Operation type: 0-add, 1-remove |
| `sceneId` | `string` | Yes | - | `3.1.1` | Scene ID |
| `name` | `string` | Yes | - | `3.1.1` | Scene name |
| `iconUrl` | `string` | No | - | `3.1.1` | Scene logo |
| `complete` | `() => void` | No | - | - | Completion callback (executed on both success and failure) |
| `success` | `(params: Object) => void` ↓see below | No | - | - | Callback on successful API call |
| `fail` | `(params: Object) => void` ↓see below | No | - | - | Failure callback |

#### success callback parameters

| Property | Type | Since | Description |
| --- | --- | --- | --- |
| `operationStep` | `number` | `3.1.2` | Operation step: 0-add, 1-remove, 2-update, 3-cancel |
| `operationStatus` | `boolean` | `3.1.2` | Operation status: YES for success; NO for failure |

#### fail callback parameters

| Property | Type | Description |
| --- | --- | --- |
| `errorMsg` | `string` | Error message |
| `errorCode` | `string \| number` | Error code |
| `innerError` | `Object` | Error extension |

##### fail(params).innerError properties

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


### Examples

#### Demo

```tsx
import { handleShortcut } from '@ray-js/ray'

handleShortcut({
  type: 1,
  sceneId: "xx",
  name: "xx",
  iconUrl: "xx",
  success: data => {
    console.log(data);
  },
  fail: error => {
    console.error(error);
  },
});
```
