1# Shortcut Key Development
2
3## When to Use
4
5You can set the delay for starting an ability using the shortcut key. An example is to take a screenshot 5 seconds after the shortcut key is pressed.
6
7## Modules to Import
8
9```js
10import { shortKey } from '@kit.InputKit';
11```
12
13## Available APIs
14
15The following table lists the common APIs provided by the **shortKey** module. For details, see [ohos.multimodalInput.shortKey](../../reference/apis-input-kit/js-apis-shortKey-sys.md).
16
17| API | Description|
18| ------------------------------------------------------------ | -------------------------- |
19| setKeyDownDuration(businessKey: string, delay: number, callback: AsyncCallback<void>): void |Sets the delay for starting an ability using the shortcut key.|
20
21## How to Develop
22
23The following describes how to take a screenshot five seconds after the shortcut key is pressed.
24
25```js
26import { shortKey } from '@kit.InputKit';
27try {
28  shortKey.setKeyDownDuration("screenshot", 500, (error) => {// Set the delay to 5 seconds (500 ms)
29    if (error) {
30      console.log(`Set key down duration failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
31      return;
32    }
33    console.log(`Set key down duration success`);
34  });
35} catch (error) {
36  console.log(`Set key down duration failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
37}
38```
39