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

Use navigator.userAgent to determine the runtime #2717

Closed
yusukebe opened this issue May 18, 2024 · 3 comments
Closed

Use navigator.userAgent to determine the runtime #2717

yusukebe opened this issue May 18, 2024 · 3 comments
Labels
enhancement New feature or request.

Comments

@yusukebe
Copy link
Member

What is the feature you are proposing?

This is not a new feature. Refactoring mater. Currently, getRuntimeKey() in hono/adapter determines the runtime by checking the global object like the following:

if (typeof global?.WebSocketPair === 'function') {
  return 'workerd'
}

But, I noticed that we can use navigator.userAgent instead of it. Context: https://x.com/jasnell/status/1791106278103879835

Checking navigator.userAgent is better than global?.WebSocketPair.

@yusukebe yusukebe added the enhancement New feature or request. label May 18, 2024
@6km
Copy link
Contributor

6km commented May 28, 2024

@yusukebe I'm working on a PR.

6km added a commit to 6km/hono that referenced this issue May 28, 2024
use navigator.userAgent to detect runtime

Closes honojs#2717
@6km
Copy link
Contributor

6km commented May 29, 2024

this has been implemented and merged by #2846

@yusukebe
Copy link
Member Author

yusukebe commented Jun 4, 2024

Now we can close this issue. Thanks!

@yusukebe yusukebe closed this as completed Jun 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request.
Projects
None yet
Development

No branches or pull requests

2 participants