plumatic / dommy

A tiny ClojureScript DOM manipulation and event library
759 stars 73 forks source link

Listen to keypress #80

Closed siscia closed 9 years ago

siscia commented 10 years ago

There is a way to listen for a key{press-down-up} ?

I haven't found it...

cpetzold commented 9 years ago

You can think of dommy.core/listen! as essentially analogous to the native addEventListener since it's really just a light wrapper around it. Adding a key event is as simple as:

(dommy/listen! element :keydown (fn [e] (js/console.log e)))