Skip to content

feat: add an idempotent menubar teardown API - #504

Open
Parthu-M wants to merge 1 commit into
max-mapper:masterfrom
Parthu-M:agent/destroy-menubar-instance
Open

feat: add an idempotent menubar teardown API#504
Parthu-M wants to merge 1 commit into
max-mapper:masterfrom
Parthu-M:agent/destroy-menubar-instance

Conversation

@Parthu-M

Copy link
Copy Markdown

Summary

  • add idempotent destroy() and isDestroyed() APIs
  • remove only the app and tray listeners registered by the Menubar instance
  • clear pending timers, destroy the BrowserWindow, and release an owned Tray
  • preserve a caller-supplied Tray while detaching Menubar's listeners
  • document the lifecycle APIs and add regression coverage

Why

Applications that switch between tray and regular-window modes currently have no supported way to tear down a Menubar instance. This provides explicit, repeatable cleanup without using removeAllListeners(), which could remove listeners owned by the consuming application.

Fixes #281.

Validation

  • corepack yarn test src/Menubar.spec.ts --runInBand --modulePathIgnorePatterns=lib (7 tests passed)
  • npx --yes --package=typescript@5.9.2 tsc --noEmit --skipLibCheck
  • corepack yarn biome check src/Menubar.ts src/Menubar.spec.ts src/__mocks__/electron.ts --formatter-enabled=false --max-diagnostics=100 (no errors)

@Parthu-M
Parthu-M marked this pull request as ready for review July 31, 2026 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Destroy Menubar

1 participant