• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# ShortcutInfo
2<!--Kit: Ability Kit-->
3<!--Subsystem: BundleManager-->
4<!--Owner: @wanghang904-->
5<!--Designer: @hanfeng6-->
6<!--Tester: @kongjing2-->
7<!--Adviser: @Brilliantry_Rui-->
8
9The module describes the shortcut information defined in the [module.json5](../../quick-start/module-configuration-file.md#shortcuts) file of an application. The information can be obtained by running [getAllShortcutInfoForSelf](js-apis-shortcutManager.md#shortcutmanagergetallshortcutinfoforself)<!--Del--> or [getShortcutInfo](js-apis-launcherBundleManager-sys.md#launcherbundlemanagergetshortcutinfo9)<!--DelEnd-->.
10
11> **NOTE**
12>
13> The initial APIs of this module are supported since API version 20. Newly added APIs will be marked with a superscript to indicate their earliest API version.
14
15## Modules to Import
16
17```ts
18import { shortcutManager } from '@kit.AbilityKit';
19```
20
21## ShortcutWant
22
23Describes a collection of target [Wants](../../quick-start/module-configuration-file.md#wants) information defined within a shortcut.
24
25**System capability**: SystemCapability.BundleManager.BundleFramework.Launcher
26
27| Name              | Type                                   | Read-Only| Optional| Description                |
28| ------------------| --------------------------------------- | --- | --- | -------------------- |
29| targetBundle      | string                                  | No  | No | Target bundle name of the shortcut.|
30| targetModule      | string                                  | No  | Yes | Target module name of the shortcut.|
31| targetAbility     | string                                  | No  | No | Target ability name of the shortcut.|
32| parameters        | Array\<[ParameterItem](#parameteritem)> | No  | Yes | Custom data for launching the shortcut. The data must be strings. Both keys and values can be strings up to 1024 characters long.|
33
34## ShortcutInfo
35
36Describes the configuration information for a shortcut.
37
38**System capability**: SystemCapability.BundleManager.BundleFramework.Launcher
39
40| Name               | Type                                      | Read-Only| Optional| Description                        |
41| ------------------- | ----------------------------------------- | --- | --- | ---------------------------- |
42| id                  | string                                    | No | No | ID of the shortcut.|
43| bundleName          | string                                    | No | No | Bundle name of the application to which the shortcut belongs.|
44| moduleName          | string                                    | No | Yes | Module name of the shortcut.|
45| hostAbility         | string                                    | No | Yes | Name of the ability that hosts the shortcut.|
46| icon                | string                                    | No | Yes | Icon of the shortcut. The value is the index of a resource file.|
47| iconId              | number                                    | No | Yes | Resource ID of the shortcut icon.|
48| label               | string                                    | No | Yes | Label of the shortcut. The value can be descriptive text or a resource index.|
49| labelId             | number                                    | No | Yes | Resource ID of the shortcut label.|
50| wants               | Array\<[ShortcutWant](#shortcutwant)>     | No | Yes | A collection of target Wants information defined within the shortcut.|
51| appIndex            | number                                    | No | No | Index of the application clone to which the shortcut belongs.|
52| sourceType          | number                                    | No | No | Source type of the shortcut. The value **0** means a custom shortcut, and **1** means a static shortcut.|
53| visible             | boolean                                   | No | Yes | Whether the shortcut is visible. **true** if visible, **false** otherwise. The default value is **true**.|
54
55## ParameterItem
56
57Describes the custom data in the shortcut configuration. You can define your own key-value pairs, and obtain the values using the keys.
58
59**System capability**: SystemCapability.BundleManager.BundleFramework.Launcher
60
61| Name         | Type   | Read-Only| Optional| Description                           |
62| ------------- | ------ | ---- | ---- | ----------------------------- |
63| key           | string | No  | No  | Key of the custom data.|
64| value         | string | No  | No  | Value of the custom data.|
65