---
name: "handleShortcut"
mode: "kit"
versionRequirements:
  - { name: "BizKit", version: "3.1.1" }
platform:
  - "iOS"
  - "Android"
async: true
---

## handleShortcut

> [VERSION] BizKit >= 3.1.1

> [PLATFORM] iOS, Android

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

### Description

Manage shortcuts (add/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 | - | - | Complete callback (invoked on success or failure) |
| `success` | `(params: Object) => void` ↓see below | No | - | - | Success callback |
| `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` | Extended error code |
| `errorMsg` | `string` | Extended error message |


### Examples

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