Skip to content

Commit

Permalink
chore: Simplify keyboard shortcuts (#1284)
Browse files Browse the repository at this point in the history
  • Loading branch information
aklinker1 authored Dec 17, 2024
1 parent 64a704f commit 039c561
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions packages/wxt/src/core/keyboard-shortcuts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand All @@ -27,26 +26,19 @@ export function createKeyboardShortcuts(

return {
start() {
if (isWatching) return;
if (rl) return;

rl = readline.createInterface({
input: process.stdin,
terminal: false, // Don't intercept ctrl+C, ctrl+Z, etc
});

rl.on('line', handleInput);
isWatching = true;
},

stop() {
if (!isWatching) return;

if (rl) {
rl.close();
rl = undefined;
}

isWatching = false;
rl?.close();
rl = undefined;
},

printHelp(flags) {
Expand Down

0 comments on commit 039c561

Please sign in to comment.