Fork me on GitHub
#clojurescript
<
2024-05-22
>
DrLjótsson18:05:53

Any good advice on a simple solution to capture key combinations in clojurescript? Like ctrl+shift+T?

Sam Ferrell18:05:48

There are many Javascript libraries for this purpose like https://www.npmjs.com/package/hotkeys-js

Sam Ferrell18:05:00

Otherwise you would just listen to the DOM for keyboard events and build something yourself, maybe by pushing pressed keys into a set and checking if all the keys in the combo are presently in it

Sam Ferrell18:05:09

For THAT particular combination you can actually just listen to key presses for T and check if shiftKey and ctrlKey are true in the event

1
🙏 1
DrLjótsson22:05:53

Works perfect with vanilla event handling, thanks!