Pebble.Button

Button subscriptions for Pebble watches.

Use onPress for simple handlers, or on / onLongPress for finer control. Combine multiple buttons with Pebble.Events.batch.

import Pebble.Button as Button
import Pebble.Events as Events

type Msg
    = UpPressed
    | SelectPressed

subscriptions _ =
    Events.batch
        [ Button.onPress Button.Up UpPressed
        , Button.onPress Button.Select SelectPressed
        ]

Native Pebble C API

  • Clicks on developer.repebble.com

Types

Button

type Button
    = Back
    | Up
    | Select
    | Down

Physical buttons available on a Pebble watch.

Event

type Event
    = Pressed
    | Released
    | LongPressed

Button event edge to subscribe to.

Subscriptions

on

on : Button -> Event -> msg -> Sub msg

Subscribe to a specific button event.

onPress

onPress : Button -> msg -> Sub msg

Subscribe to a button press.

onRelease

onRelease : Button -> msg -> Sub msg

Subscribe to a button release.

onLongPress

onLongPress : Button -> msg -> Sub msg

Subscribe to a long button press.