keymaster
keymaster copied to clipboard
Support server side rendering
Prevents use of window when it is not defined to allow server side rendering
What's the purpose of this? Why would you want to use a library for keyboard shortcuts on the server?
Not meant to use on the server, but if included on the server it shouldn't throw an error. When working with techs like react where your components also usually need to be rendered on the server side including keymaster dependency shouldn't throw an error. (of course I don't call it unless it's on the client side) at least this is my use case
Please merge this. If it's still unclear why, I'll try to explain. React supports applications that can run both on the server and the client with the same codebase. For example the first load might be server-rendered to improve the load time but then the client takes over for real-time updates and similar. It isn't the keyboard events themselves that must work on the server (which they of course can't) but it must not crash so that the rest of the application can be rendered on the server.
Would really really love to see this merged!
is there a chance that this PR will be merged?
Same needing here – using with next.js.
Alternative library on modern js supports SSR https://github.com/elv1n/keybuddy
I've merged this here As I use this library and it hasn't been touched in two years, and has many prs and issues, I'll be maintaining it in my fork.