CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-electron-debug

Adds useful debug features to your Electron app

86

1.19x
Overview
Eval results
Files

task.mdevals/scenario-7/

Electron Keyboard Shortcut Manager

Build a keyboard shortcut manager for an Electron application that registers global keyboard shortcuts for common development operations. The manager must properly handle Electron app initialization timing.

Requirements

Initialization

The manager must properly handle the asynchronous Electron app initialization process. Keyboard shortcuts must only be registered after the app is fully ready to accept global shortcuts. The initialization function should work correctly even if called before the app has finished initializing.

Keyboard Shortcuts

Implement two global keyboard shortcuts:

  1. Reload Shortcut (CommandOrControl+R): Reloads the currently focused browser window, ignoring the cache
  2. Toggle DevTools (F12): Opens or closes the developer tools for the currently focused browser window

Window Targeting

Both shortcuts should target the currently focused browser window. If no window is focused, the shortcuts should safely do nothing.

Test Cases

  • Calling the initialization function before the app is ready successfully registers shortcuts once the app becomes ready @test
  • The reload shortcut reloads the focused window with cache bypass @test
  • The DevTools shortcut correctly toggles DevTools open and closed @test
  • Both shortcuts handle the case where no window is focused without errors @test

Implementation

@generates

API

/**
 * Initialize and register keyboard shortcuts for the Electron app
 * Must handle async app initialization properly
 */
function initializeShortcuts() {
  // IMPLEMENTATION HERE
}

module.exports = {
  initializeShortcuts
};

Dependencies { .dependencies }

electron { .dependency }

Provides the Electron application framework including app lifecycle, BrowserWindow management, and global shortcut APIs.

Install with Tessl CLI

npx tessl i tessl/npm-electron-debug

tile.json