driebit/elm-swipe-events - version: 1.0.0

for more information visit the package's GitHub page

Package contains the following modules:

elm-swipe-events

Swipe events, in Elm

Adapted for Elm 0.19 from elm-touch-events.

Usage

In your model:

    { gesture = Swipe.Gesture }

In your init:

    { gesture = Swipe.blanco }

In your Msg:

    type Msg
        = Swipe Swipe.Event
        | SwipeEnd Swipe.Event

In your view:

    Html.div
        [ Swipe.onStart Swipe
        , Swipe.onMove Swipe
        , Swipe.onEnd SwipeEnd
        ]
        [ Html.text "Swipe me!" ]

In your update:

    Swipe touch ->
        { model | gesture = Swipe.record touch model.gesture }

    SwipeEnd touch ->
        let
            gesture : Swipe.Gesture
            gesture =
                Swipe.record touch model.gesture

            -- use inspection functions like `isTap` and `isLeftSwipe`
        in
        { model | gesture = Swipe.blanco }

License

BSD-3 © Ilias Van Peer