forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgithub-electron.global-shortcut.d.ts
38 lines (37 loc) · 1.52 KB
/
github-electron.global-shortcut.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// Type definitions for Electron v0.37.2
// Project: http://electron.atom.io/
// Definitions by: jedmao <https://github.com/jedmao/>, rhysd <https://rhysd.github.io>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare namespace Electron {
/**
* The globalShortcut module can register/unregister a global keyboard shortcut
* with the operating system so that you can customize the operations for various shortcuts.
* Note: The shortcut is global; it will work even if the app does not have the keyboard focus.
* You should not use this module until the ready event of the app module is emitted.
*/
interface GlobalShortcut {
/**
* Registers a global shortcut of accelerator.
* @param accelerator Represents a keyboard shortcut. It can contain modifiers
* and key codes, combined by the "+" character.
* @param callback Called when the registered shortcut is pressed by the user.
*/
register(accelerator: string, callback: Function): void;
/**
* @param accelerator Represents a keyboard shortcut. It can contain modifiers
* and key codes, combined by the "+" character.
* @returns Whether the accelerator is registered.
*/
isRegistered(accelerator: string): boolean;
/**
* Unregisters the global shortcut of keycode.
* @param accelerator Represents a keyboard shortcut. It can contain modifiers
* and key codes, combined by the "+" character.
*/
unregister(accelerator: string): void;
/**
* Unregisters all the global shortcuts.
*/
unregisterAll(): void;
}
}