# globalShortcut
# isRegistered M
# isRegistered(accelerator: string): Promise<boolean>
Whether this application has registered the accelerator
.
import { globalShortcut } from "@reactivemarkets/desktop-sdk";
const isRegistered = await globalShortcut.isRegistered("CommandOrControl+X");
# register M
# register(accelerator: string, listener: () => void): Promise<void>
Registers a global shortcut of accelerator
.
If the accelerator is already registered by another application outside of the desktop, the listener will sliently fail. This is the behavior of operating systems.
import { globalShortcut } from "@reactivemarkets/desktop-sdk";
await globalShortcut.register("CommandOrControl+X", () => {
console.info("shortcut invoked");
});
# unregister M
# unregister(accelerator: string, listener: () => void): Promise<void>
Unregisters the global shortcut of accelerator
.
import { globalShortcut } from "@reactivemarkets/desktop-sdk";
const listener = () => console.info("CommandOrControl+X invoked");
await globalShortcut.register("CommandOrControl+X", listener);
await globalShortcut.unregister("CommandOrControl+X", listener);
# unregisterAll M
# unregisterAll(): Promise<void>
Unregisters all global shortcuts for this application.
import { globalShortcut } from "@reactivemarkets/desktop-sdk";
await globalShortcut.unregisterAll();