Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide a way to reopen the browser #348

Open
WOSHIZHAZHA120 opened this issue Jan 16, 2024 · 2 comments
Open

Provide a way to reopen the browser #348

WOSHIZHAZHA120 opened this issue Jan 16, 2024 · 2 comments
Labels
Milestone

Comments

@WOSHIZHAZHA120
Copy link
Contributor

WOSHIZHAZHA120 commented Jan 16, 2024

Feature Request

Provides a way to reopen the browser. For example, Vite can be restarted using the r key.

Is your feature request related to a bug?

N/A

What are the alternatives?

Restarted the wxt process but also trigger the build

Additional context

@WOSHIZHAZHA120 WOSHIZHAZHA120 changed the title Provide a method to reopen the browser Provide a way to reopen the browser Jan 16, 2024
@aklinker1
Copy link
Collaborator

We can listen for key presses like so:

let readline = require('readline');

readline.emitKeypressEvents(process.stdin);

process.stdin.on('keypress', (ch, key) => {
  console.log('got "keypress"', ch, key);
  if (key && key.ctrl && key.name == 'c') {
    process.stdin.pause();
  }
});

process.stdin.setRawMode(true);

https://stackoverflow.com/questions/43286881/how-do-i-detect-whether-a-key-is-pressed-in-node-js#answer-74545520

Here's how Vite does it:

https://github.com/vitejs/vite/blob/bf1e9c2fd7b05f84d05e59f72b3fc26ca22807bb/packages/vite/src/node/shortcuts.ts

@aklinker1
Copy link
Collaborator

I like the idea of a few keyboard shortcuts for the dev server.

@aklinker1 aklinker1 added this to the v1.1 milestone Mar 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants