Skip to content

Commit

Permalink
[#5] clear previously tracked keys whenever the rules change;
Browse files Browse the repository at this point in the history
  • Loading branch information
gadfly361 committed Jun 18, 2018
1 parent 23a15c0 commit 68a1863
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 2 deletions.
6 changes: 6 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changes

## 0.2.2 (2018-06-18)

Bug Fixes

- [#5 need to clear the previously tracked keys whenever the rules change](https://github.com/gadfly361/re-pressed/issues/5)

## 0.2.1 (2018-05-28)

Bug Fixes
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Re-pressed is a library that handles keyboard events
for [re-frame](https://github.com/Day8/re-frame) applications.

```clojure
[re-pressed "0.2.1"]
[re-pressed "0.2.2"]
```
And in your ns:
```clojure
Expand Down
2 changes: 1 addition & 1 deletion project.clj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(defproject re-pressed "0.2.1"
(defproject re-pressed "0.2.2"
:description "A keyboard events library for re-frame"
:url "https://github.com/gadfly361/re-pressed"
:license {:name "MIT"}
Expand Down
13 changes: 13 additions & 0 deletions src/demo/re_pressed/views.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,28 @@
card]))
]]

[:a {:href "#/about"}
"go to about page"]

]))


;; about

(defn about-panel []
[:div
[:h1 "About page"]
[:a {:href "#/"}
"go to about page"]])



;; main

(defn- panels [panel-name]
(case panel-name
:home-panel [home-panel]
:about-panel [about-panel]
[:div]))

(defn show-panel [panel-name]
Expand Down
3 changes: 3 additions & 0 deletions src/main/re_pressed/core.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
prevent-default-keys]
:as opts}]]
{:db (-> db
(assoc-in [::keydown :keys] nil)
(assoc-in [::keydown :event-keys] event-keys)
(assoc-in [::keydown :clear-keys] clear-keys)
(assoc-in [::keydown :always-listen-keys] always-listen-keys)
Expand All @@ -40,6 +41,7 @@
always-listen-keys]
:as opts}]]
{:db (-> db
(assoc-in [::keypress :keys] nil)
(assoc-in [::keypress :event-keys] event-keys)
(assoc-in [::keypress :clear-keys] clear-keys)
(assoc-in [::keypress :always-listen-keys] always-listen-keys)
Expand All @@ -54,6 +56,7 @@
always-listen-keys]
:as opts}]]
{:db (-> db
(assoc-in [::keyup :keys] nil)
(assoc-in [::keyup :event-keys] event-keys)
(assoc-in [::keyup :clear-keys] clear-keys)
(assoc-in [::keyup :always-listen-keys] always-listen-keys)
Expand Down

0 comments on commit 68a1863

Please sign in to comment.