keymaster icon indicating copy to clipboard operation
keymaster copied to clipboard

Support server side rendering

Open bruno12mota opened this issue 9 years ago • 8 comments

Prevents use of window when it is not defined to allow server side rendering

bruno12mota avatar Apr 23 '15 14:04 bruno12mota

What's the purpose of this? Why would you want to use a library for keyboard shortcuts on the server?

madrobby avatar May 17 '16 18:05 madrobby

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

bruno12mota avatar May 17 '16 18:05 bruno12mota

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.

Pajn avatar Jul 31 '16 11:07 Pajn

Would really really love to see this merged!

edwellbrook avatar Apr 09 '17 02:04 edwellbrook

is there a chance that this PR will be merged?

mpospelov avatar Aug 07 '18 08:08 mpospelov

Same needing here – using with next.js.

ythecombinator avatar Aug 09 '18 00:08 ythecombinator

Alternative library on modern js supports SSR https://github.com/elv1n/keybuddy

elv1n avatar Jun 23 '19 13:06 elv1n

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.

vincens2005 avatar Jan 30 '21 06:01 vincens2005