MCPcopy
hub / github.com/alibaba/lowcode-engine / Hotkey

Class Hotkey

packages/shell/src/api/hotkey.ts:7–53  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5const innerHotkeySymbol = Symbol('innerHotkey');
6
7export class Hotkey implements IPublicApiHotkey {
8 private readonly [innerHotkeySymbol]: InnerHotkey;
9 get [hotkeySymbol](): InnerHotkey {
10 if (this.workspaceMode) {
11 return this[innerHotkeySymbol];
12 }
13 const workspace = globalContext.get('workspace');
14 if (workspace.isActive) {
15 return workspace.window.innerHotkey;
16 }
17
18 return this[innerHotkeySymbol];
19 }
20
21 constructor(hotkey: InnerHotkey, readonly workspaceMode: boolean = false) {
22 this[innerHotkeySymbol] = hotkey;
23 }
24
25 get callbacks(): IPublicTypeHotkeyCallbacks {
26 return this[hotkeySymbol].callBacks;
27 }
28
29 /**
30 * @deprecated
31 */
32 get callBacks() {
33 return this.callbacks;
34 }
35
36 /**
37 * 绑定快捷键
38 * @param combos 快捷键,格式如:['command + s'] 、['ctrl + shift + s'] 等
39 * @param callback 回调函数
40 * @param action
41 * @returns
42 */
43 bind(
44 combos: string[] | string,
45 callback: IPublicTypeHotkeyCallback,
46 action?: string,
47 ): IPublicTypeDisposable {
48 this[hotkeySymbol].bind(combos, callback, action);
49 return () => {
50 this[hotkeySymbol].unbind(combos, callback, action);
51 };
52 }
53}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…