diff --git a/src/Browser/Events.elm b/src/Browser/Events.elm index 0dec4ec..e060ae6 100644 --- a/src/Browser/Events.elm +++ b/src/Browser/Events.elm @@ -2,6 +2,7 @@ effect module Browser.Events where { subscription = MySub } exposing ( onAnimationFrame, onAnimationFrameDelta , onKeyPress, onKeyDown, onKeyUp , onClick, onMouseMove, onMouseDown, onMouseUp + , onTouchStart, onTouchEnd, onTouchCancel, onTouchMove , onResize, onVisibilityChange, Visibility(..) ) @@ -30,6 +31,10 @@ If there is something else you need, use [ports] to do it in JavaScript! @docs onClick, onMouseMove, onMouseDown, onMouseUp +# Touchscreen + +@docs onTouchStart, onTouchEnd, onTouchCancel, onTouchMove + # Window @docs onResize, onVisibilityChange, Visibility @@ -176,6 +181,33 @@ onMouseUp : Decode.Decoder msg -> Sub msg onMouseUp = on Document "mouseup" +-- TOUCHSCREEN + +{-| Subscribe to touch start events anywhere on screen. +-} +onTouchStart : Decode.Decoder msg -> Sub msg +onTouchStart = + on Document "touchstart" + + +{-| Subscribe to touch end events anywhere on screen. +-} +onTouchEnd : Decode.Decoder msg -> Sub msg +onTouchEnd = + on Document "touchend" + +{-| Subscribe to touch cancel events anywhere on screen. +-} +onTouchCancel : Decode.Decoder msg -> Sub msg +onTouchCancel = + on Document "touchcancel" + +{-| Subscribe to touch movement events anywhere on screen. +-} +onTouchMove : Decode.Decoder msg -> Sub msg +onTouchMove = + on Document "touchmove" + -- WINDOW