Exercises
In this exercise, we will modify the om-pm
project we created in the previous section. The objective is to add keyboard shortcuts so that power users can operate the agile board more efficiently.
The shortcuts to be supported are as follows:
- The
up
,down
,left
, andright
arrow keys: These allow the user to navigate through the cards, highlighting the current one - The
n
andp
keys: These are used to move the current card to the next (right) or previous (left) column, respectively
The key insight here is to create a new core.async
channel, which will contain keypress events. These events will then trigger the actions that were outlined previously. We can use the Google Closure library to listen for events. Just add the following require
to the application namespace:
(:require [goog.events :as events])
Then, use the following function to create a channel from DOM events:
(defn listen [el type] (let [c (chan)] (events/listen el type #(put! c %)) c))
The actual logic of moving...