@bbx-audio/nectar
    Preparing search index...

    Interface IGlobalEventManager

    Describes an object that manages event handlers and state for global window and DOM events.

    interface IGlobalEventManager {
        isAltPressed(): boolean;
        isCtrlPressed(): boolean;
        isKeyPressed(key: string): boolean;
        isShiftPressed(): boolean;
        subscribeToClick(callback: (event: MouseEvent) => void): () => void;
        subscribeToKey(
            key: string,
            callback: (pressed: boolean, event: KeyboardEvent) => void,
        ): () => void;
    }
    Index

    Methods

    • Checks whether the "Ctrl" key is pressed.

      Returns boolean

    • Checks whether a given key is pressed.

      Parameters

      • key: string

      Returns boolean

    • Checks whether the "Shift" key is pressed.

      Returns boolean

    • Subscribes to a global click event, executing the callback provided when the mouse is clicked.

      Parameters

      • callback: (event: MouseEvent) => void

      Returns () => void

    • Subscribes to a global key event, executing the callback provided when the key is both pressed (key down) and released (key up).

      Parameters

      • key: string
      • callback: (pressed: boolean, event: KeyboardEvent) => void

      Returns () => void