UNPKG

@launchmenu/core

Version:

An environment for visual keyboard controlled applets

30 lines 1.37 kB
import type IOHook from "iohook"; import { IGlobalKeyEvent } from "./_types/IGlobalKeyEvent"; export declare class GlobalKeyHandler { protected keyListeners: ((event: IGlobalKeyEvent) => void)[]; protected invokeListeners: (event: IGlobalKeyEvent) => void | undefined; protected started: boolean; /** * Adds a global key listeners that listens to all events * @param callback The key press callback * @returns A function that can be invoked to remove the listener */ addGlobalListener(callback: (event: IGlobalKeyEvent) => void): () => void; /** * Adds a global shortcut * @param shortcut The keycodes of the shortcut to listener for (I don't know the actual code mappings, but they are consistent with addGlobalListener) * @param callback The callback to trigger when the event is fired * @returns A function that can be invoked to remove the shortcut */ addGlobalShortcut(shortcut: number[], callback: () => void): () => void; /** * Starts IOHook if it wasn't started already */ protected start(): void; protected ioHook(): typeof IOHook; } /** * The manager to handle global key events (events that occur even when LM isn't focused) */ export declare const globalKeyHandler: GlobalKeyHandler; //# sourceMappingURL=globalKeyHandler.d.ts.map