Home > SYS_ShortcutKey > unregisterShortcutKey
SYS_ShortcutKey.unregisterShortcutKey() method
This API is provided as a beta preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Warning: This API is now obsolete.
since EDA v4.2
Unregister a shortcut key
Signature
typescript
function unregisterShortcutKey(shortcutKey: TSYS_ShortcutKeys): Promise<boolean>;1
Parameters
Parameter | Type | Description |
|---|---|---|
shortcutKey | Shortcut key. The order of the passed-in elements is not distinguished; it will be sorted automatically and the matching shortcut key will be queried |
Returns
Promise<boolean>
Whether the unregistration operation was successful
Example
javascript
// 1. 先注册一个演示快捷键作为操作对象
await eda.sys_ShortcutKey.registerShortcutKey(
['CONTROL', 'ALT', 'F9'],
'嘉立创示例_待移除快捷键',
() => {}
);
// 2. 反注册:故意打乱键序传入,验证不区分排列顺序的匹配规则
const ok = await eda.sys_ShortcutKey.unregisterShortcutKey(['F9', 'ALT', 'CONTROL']);
console.log('反注册返回:', ok);
// 3. 复查快捷键列表,确认演示键位已被移除
const list = await eda.sys_ShortcutKey.getShortcutKeys();
const still = list.some(item => item.title === '嘉立创示例_待移除快捷键');
console.log('反注册后仍在列表中:', still);1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
2
3
4
5
6
7
8
9
10
11
12
13
14
15