-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add global keyboard shortcut support with operating system (#214)
- Loading branch information
Showing
7 changed files
with
196 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/** | ||
* @module @morgan-stanley/desktopjs | ||
*/ | ||
|
||
/** Register/unregister a glboal keyboard shortcut with the operating system so that you | ||
* can customize the operations for various shortcuts. | ||
*/ | ||
export abstract class GlobalShortcutManager { // tslint:disable-line | ||
/** Registers a global shortcut. | ||
* @param shortcut {string} [Accelerator]{@link https://electronjs.org/docs/api/accelerator} | ||
*/ | ||
public abstract register(shortcut: string, callback: () => void): Promise<void>; | ||
|
||
/** Checks if a given shortcut has been registered. | ||
* @param shortcut {string} [Accelerator]{@link https://electronjs.org/docs/api/accelerator} | ||
* @returns {Promise<boolean>} A Promise that resolves to a boolean whether the shortcut is already registered. | ||
*/ | ||
public abstract isRegistered(shortcut: string): Promise<boolean>; | ||
|
||
/** Removes a previously registered shortcut. | ||
* @param shortcut {string} [Accelerator]{@link https://electronjs.org/docs/api/accelerator} | ||
*/ | ||
public abstract unregister(shortcut: string): Promise<void>; | ||
|
||
/** Removes all registered shortcuts for the current application. */ | ||
public abstract unregisterAll(): Promise<void>; | ||
} |