From 039c561a80718e765376221f771d66949fe92c47 Mon Sep 17 00:00:00 2001 From: Aaron Date: Tue, 17 Dec 2024 11:55:50 -0600 Subject: [PATCH] chore: Simplify keyboard shortcuts (#1284) --- packages/wxt/src/core/keyboard-shortcuts.ts | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/packages/wxt/src/core/keyboard-shortcuts.ts b/packages/wxt/src/core/keyboard-shortcuts.ts index 6268e7505..1330aaa71 100644 --- a/packages/wxt/src/core/keyboard-shortcuts.ts +++ b/packages/wxt/src/core/keyboard-shortcuts.ts @@ -15,7 +15,6 @@ export interface KeyboardShortcutWatcher { export function createKeyboardShortcuts( server: WxtDevServer, ): KeyboardShortcutWatcher { - let isWatching = false; let rl: readline.Interface | undefined; const handleInput = (line: string) => { @@ -27,7 +26,7 @@ export function createKeyboardShortcuts( return { start() { - if (isWatching) return; + if (rl) return; rl = readline.createInterface({ input: process.stdin, @@ -35,18 +34,11 @@ export function createKeyboardShortcuts( }); rl.on('line', handleInput); - isWatching = true; }, stop() { - if (!isWatching) return; - - if (rl) { - rl.close(); - rl = undefined; - } - - isWatching = false; + rl?.close(); + rl = undefined; }, printHelp(flags) {