I’m trying to get modifer key data from an event with jayq (see here).
This works just fine
(delegate $body note-list-item :click
(fn [e]
(.preventDefault e)
(js/alert "clicked!")))
But this doesn’t.
(delegate $body note-list-item :click
(fn [e]
(.preventDefault e)
(if (.metaKey e)
(js/alert "meta clicked")
(js/alert "no meta"))))
The Javascript console in Chrome gives me Uncaught TypeError: Property 'metaKey' of object #<Object> is not a function
And then I immediately figured it out, of course.
metaKeyis a property of the object, not a method. In Clojurescript you get it with(.-metaKey e)(note the dash). See here for more details.