1e41f4b71Sopenharmony_ci# Shortcut Key Development 2e41f4b71Sopenharmony_ci 3e41f4b71Sopenharmony_ci## When to Use 4e41f4b71Sopenharmony_ci 5e41f4b71Sopenharmony_ciYou 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. 6e41f4b71Sopenharmony_ci 7e41f4b71Sopenharmony_ci## Modules to Import 8e41f4b71Sopenharmony_ci 9e41f4b71Sopenharmony_ci```js 10e41f4b71Sopenharmony_ciimport { shortKey } from '@kit.InputKit'; 11e41f4b71Sopenharmony_ci``` 12e41f4b71Sopenharmony_ci 13e41f4b71Sopenharmony_ci## Available APIs 14e41f4b71Sopenharmony_ci 15e41f4b71Sopenharmony_ciThe 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). 16e41f4b71Sopenharmony_ci 17e41f4b71Sopenharmony_ci| API | Description| 18e41f4b71Sopenharmony_ci| ------------------------------------------------------------ | -------------------------- | 19e41f4b71Sopenharmony_ci| setKeyDownDuration(businessKey: string, delay: number, callback: AsyncCallback<void>): void |Sets the delay for starting an ability using the shortcut key.| 20e41f4b71Sopenharmony_ci 21e41f4b71Sopenharmony_ci## How to Develop 22e41f4b71Sopenharmony_ci 23e41f4b71Sopenharmony_ciThe following describes how to take a screenshot five seconds after the shortcut key is pressed. 24e41f4b71Sopenharmony_ci 25e41f4b71Sopenharmony_ci```js 26e41f4b71Sopenharmony_ciimport { shortKey } from '@kit.InputKit'; 27e41f4b71Sopenharmony_citry { 28e41f4b71Sopenharmony_ci shortKey.setKeyDownDuration("screenshot", 500, (error) => {// Set the delay to 5 seconds (500 ms) 29e41f4b71Sopenharmony_ci if (error) { 30e41f4b71Sopenharmony_ci console.log(`Set key down duration failed, error: ${JSON.stringify(error, [`code`, `message`])}`); 31e41f4b71Sopenharmony_ci return; 32e41f4b71Sopenharmony_ci } 33e41f4b71Sopenharmony_ci console.log(`Set key down duration success`); 34e41f4b71Sopenharmony_ci }); 35e41f4b71Sopenharmony_ci} catch (error) { 36e41f4b71Sopenharmony_ci console.log(`Set key down duration failed, error: ${JSON.stringify(error, [`code`, `message`])}`); 37e41f4b71Sopenharmony_ci} 38e41f4b71Sopenharmony_ci``` 39