/elm-dispatch

Dispatch multiple messages in response to a single Html.Event

Primary LanguageElmApache License 2.0Apache-2.0

elm-dispatch

Dispatch multiple messages in response to a single Html.Event.

UI libraries in elm sometimes need to perform internal actions on Html.Events such as onFocus, while at the same time allowing library users to also respond to those events. This library provides such multiple dispatch.

Motivation

The library was developed for the purpose of allowing elm-mdl to have stateful components such as Textfield which also allow user provided event-handlers.

Textfield requires some internal state management on onFocus and onBlur events. However, users may also want to have event-handlers for those particular events and this is where Dispatch helps.

Install

elm package install vipentti/elm-dispatch

Example

An example of how to use the library may be found in the examples/ folder.

The library can also been seen in use in elm-mdl specifically Material.Options.Internal and Material.Options.

License

© Ville Penttinen, 2016. Licensed under an Apache-2.0 license.