Home > SYS_ShortcutKey > unregisterShortcutKey
SYS_ShortcutKey.unregisterShortcutKey() method
此 API 当前处于 BETA 预览状态,希望得到开发者的反馈。它的任何功能都可能在接下来的开发进程中被修改,请不要将它用于任何正式环境。
警告:此 API 现已弃用。
since EDA v4.2
反注册快捷键
签名
typescript
function unregisterShortcutKey(shortcutKey: TSYS_ShortcutKeys): Promise<boolean>;1
参数名
参数 | 类型 | 描述 |
|---|---|---|
shortcutKey | 快捷键,不区分传入的排列顺序,将自动排序并查询匹配的快捷键 |
返回值
Promise<boolean>
反注册操作是否成功
示例
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