Documentation
    Preparing search index...

    Manages keyboard shortcuts for development server interaction.

    The ShortcutsManager provides a convenient way to handle keyboard inputs during development, allowing users to restart servers, clear console, open browsers, and perform other common development tasks through simple key presses.

    const shortcuts = new ShortcutsManager({
    logger: ui.logger,
    callbacks: {
    onRestart: () => server.restart(),
    onClear: () => console.clear(),
    onQuit: () => process.exit()
    }
    })
    shortcuts.setup()
    Index

    Constructors

    Methods

    • Set server url for opening in browser

      This URL will be used when the user presses 'o' to open the development server in their default browser.

      Parameters

      • url: string

        The server URL to open when 'o' key is pressed

      Returns void

    • Initialize keyboard shortcuts by setting up raw mode on stdin

      This method enables raw mode on stdin to capture individual keypresses and sets up the event listener for handling keyboard input. Only works in TTY environments.

      Returns void

    • Show available keyboard shortcuts in the console

      Displays a formatted list of all available keyboard shortcuts and their descriptions to help users understand what actions are available.

      Returns void

    • Cleanup keyboard shortcuts and restore terminal state

      Disables raw mode on stdin, removes event listeners, and restores the terminal to its normal state. Should be called when shutting down the development server.

      Returns void