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-2/

Development Window Refresher

Build a utility for Electron applications that provides a convenient way to refresh browser windows during development, ensuring that the latest changes are always loaded by bypassing the browser cache.

Requirements

Your implementation should provide a function that:

  1. Reloads the current application window, bypassing the HTTP cache to ensure fresh content is loaded
  2. Works with either a specified window or automatically targets the currently focused window if no window is provided
  3. Can be called programmatically from anywhere in the application

Expected Behavior

  • When called with a window parameter, the function should reload that specific window
  • When called without parameters, it should reload the currently focused window
  • The reload operation must ignore any cached content to ensure the latest version is displayed
  • If no valid window is available, the function should handle this gracefully without crashing

Test Cases

Create a test file at ../test/refresh.test.js with the following test cases:

  • Calling the refresh function with a valid BrowserWindow reloads that window ignoring cache @test
  • Calling the refresh function without parameters reloads the focused window ignoring cache @test
  • Calling the refresh function when no window is focused handles the situation gracefully @test

Implementation

@generates

API

/**
 * Reloads a browser window, ignoring the cache to ensure fresh content.
 *
 * @param {BrowserWindow} [window] - The window to reload. If not provided, uses the focused window.
 */
function refresh(window) {
  // Implementation here
}

module.exports = { refresh };

Dependencies { .dependencies }

electron-debug { .dependency }

Provides debugging utilities for Electron applications, including window refresh capabilities.

@satisfied-by

Install with Tessl CLI

npx tessl i tessl/npm-electron-debug

tile.json