Skinney/keyboard-events/1.0.0

NOTE: the latest version is 2.0.1

Renamed to robinheghan/keyboard-events. It is published under that name, and new versions come out there.

Versions published as Skinney/keyboard-events still install under that name. 3 versions of 3 come from the new location (see their notes).

Rerouted (renamed, verified). The GitHub user or repository was renamed. The tag is still there, at the new name. The Lamdera package server serves a copy recovered from https://github.com/robinheghan/keyboard-events.

What we checked: The repo moved to github.com/robinheghan/keyboard-events. Rebuilt with git archive from commit e302fbbe3b71 of https://github.com/robinheghan/keyboard-events (zip prefix Skinney-keyboard-events-e302fbb/, America/Los_Angeles times): the zip is byte-identical to the one package.elm-lang.org recorded, SHA-1 63dafc336594f4dd5e5075a5adc6ff966bd6464a.

The Lamdera compiler uses this copy and prints a one-line notice saying so. elm itself fails to download this version.

Details · package.elm-lang.org's zip: https://github.com/Skinney/keyboard-events/zipball/1.0.0/

Keyboard.Events

Functions that send messages based on key events.

The functions in this namespace uses the keyboard event api, which is supported in most browsers (including IE11).

Html Events

onKeyDown : List ( Key, msg ) -> Attribute msg

Takes a list of key-message pairs and triggers a message if the corresponding key is pressed.

onKeyPress : List ( Key, msg ) -> Attribute msg

Takes a list of key-message pairs and triggers a message if the corresponding key is pressed. This differs from onKeyDown in that it will only trigger a message if the associated key produces a character.

If you want to trigger actions when a control key is pressed (like the Escape key), use onKeyDown instead.

onKeyUp : List ( Key, msg ) -> Attribute msg

Takes a list of key-message pairs and triggers a message if the corresponding key is released.

Decoder

keyDecoder : Decoder Key

This decoder is supposed to be used with html events. It detects which key has been pressed and returns it.

Html.Events.on "keydown" <| Json.map KeyPressed keyDecoder