elm-lang/svg/1.1.0

NOTE: this package moved to elm/svg

NOTE: this package is not compatible with Elm 0.19.1

Svg.Events

Animation event attributes

onBegin : msg -> Attribute msg
onEnd : msg -> Attribute msg
onRepeat : msg -> Attribute msg

Document event attributes

onAbort : msg -> Attribute msg
onError : msg -> Attribute msg
onResize : msg -> Attribute msg
onScroll : msg -> Attribute msg
onLoad : msg -> Attribute msg
onUnload : msg -> Attribute msg
onZoom : msg -> Attribute msg

Graphical event attributes

onActivate : msg -> Attribute msg
onClick : msg -> Attribute msg
onFocusIn : msg -> Attribute msg
onFocusOut : msg -> Attribute msg
onMouseDown : msg -> Attribute msg
onMouseMove : msg -> Attribute msg
onMouseOut : msg -> Attribute msg
onMouseOver : msg -> Attribute msg
onMouseUp : msg -> Attribute msg

Custom Events

on : String -> Decoder msg -> Attribute msg

Create a custom event listener.

import Json.Decode as Json


onClick : msg -> Attribute msg
onClick msg =
  on "click" (Json.succeed msg)

You first specify the name of the event in the same format as with JavaScript’s addEventListener. Next you give a JSON decoder, which lets you pull information out of the event object. If the decoder succeeds, it will produce a message and route it to your update function.