Skip to content

Commit

Permalink
update README;
Browse files Browse the repository at this point in the history
  • Loading branch information
gadfly361 committed Apr 17, 2018
1 parent 567fb02 commit 9afdbbe
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,20 +53,20 @@ application *first* loads.
There are three options, and you can use more than one if you'd like:

```clojure
(rf/dispatch-sync [::rp/add-keyboard-event-listener "keydown"])
(re-frame/dispatch-sync [::rp/add-keyboard-event-listener "keydown"])

;; or
(rf/dispatch-sync [::rp/add-keyboard-event-listener "keypress"])
(re-frame/dispatch-sync [::rp/add-keyboard-event-listener "keypress"])

;; or
(rf/dispatch-sync [::rp/add-keyboard-event-listener "keyup"])
(re-frame/dispatch-sync [::rp/add-keyboard-event-listener "keyup"])
```

### `::rp/set-keydown-rules`

`::rp/set-keydown-rules` takes a hash-map of `:event-keys`,
`:clear-keys`, and `:prevent-default-keys` and listens for *keydown*
events.
`:clear-keys`, `:always-listen-keys`, and `:prevent-default-keys` and
listens for *keydown* events.

- For `:event-keys`, there is a vector of *event + key combo* vectors.
If any of the key combos are true, then the event will get
Expand All @@ -84,7 +84,7 @@ events.
This is a description of the shape:

```clojure
(rf/dispatch
(re-frame/dispatch
[::rp/set-keydown-rules
{:event-keys [
[<event vector>
Expand Down Expand Up @@ -275,7 +275,7 @@ want to handle keyboard events differently on each page).
numbers. This is unlike keydown and keyup events, where you have
access to more things like the Escape key.
- Using `:prevent-default-keys` only works with
`::rp/set-keydown-rules`. This is because the default action will
`::rp/set-keydown-rules`. This is because the default browser action will
happen before keypress and keyup events happen.
- Certain browser default actions cannot be overwritten, like `ctrl+n`
in chrome.
Expand Down

0 comments on commit 9afdbbe

Please sign in to comment.