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:

  • The up, down, left, and right arrow keys: These allow the user to navigate through the cards, highlighting the current one
  • The n and p 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 key press events. These events will then trigger the actions 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 this 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 the cards around based on keyboard shortcuts can be implemented in a number of ways, so don't forget to compare your solution with the answers provided in this book's companion code.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.119.158.134