Skinney/keyboard-events/2.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 c1b13b28bfdc of https://github.com/robinheghan/keyboard-events (zip prefix Skinney-keyboard-events-c1b13b2/, America/Los_Angeles times): the zip is byte-identical to the one package.elm-lang.org recorded, SHA-1 720d88701cf716c2a7fc9f25f8d6803841637488.

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/2.0.0/

Keyboard.Events

Send message when a given key is pressed while a certain Html element has focus.

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

This package makes use of a Keyboard custom type from the ohanhi/Keyboard package, so you'll need that as a direct dependency.

Html Events

type Event
= Keydown
| Keyup
| Keypress

When should a message be triggered? Keydown triggers when a key on your keyboard is pressed down. Keyup triggers when a key is release. Keypress only triggers if the key produces a character. If you want to trigger a message when the spacebar is pressed, use Keydown instead.

on : Event -> List ( Key, msg ) -> Attribute msg

Listen for the corresponding event, and trigger the message that corresponds with the given Key. Works the same as Html.Events.on.

-> { preventDefault : Bool
, stopPropagation : Bool
}
-> List ( Key, msg )
-> Attribute msg

Works like on, but allows you to specify if the default action or propogation should be stopped if a message is triggered.

-> List
( Key
, { message : msg
, preventDefault : Bool
, stopPropagation : Bool
}
)
-> Attribute msg

Works like custom, but allows you to specify if the default action or propogation should be stopped if a message is triggered for a specific Key.