Elm Pebble

Pebble.Platform

Platform glue for Pebble watch applications.

This module wraps `Platform.worker` so your `init` function receives a typed `LaunchContext` decoded from JSON launch metadata.

Launch metadata

Program entrypoint

Union Types

LaunchReason

type LaunchReason
type LaunchReason
    = LaunchSystem
    | LaunchUser
    | LaunchPhone
    | LaunchWakeup
    | LaunchWorker
    | LaunchQuickLaunch
    | LaunchTimelineAction
    | LaunchSmartstrap
    | LaunchUnknown

Why the app or worker launched on the watch.

Type Aliases

LaunchScreen

type alias LaunchScreen = { width : Int
, height : Int
, isColor : Bool
, isRound : Bool
}

Screen details for the currently simulated or connected watch model.

LaunchContext

type alias LaunchContext = { reason : LaunchReason
, watchModel : String
, watchProfileId : String
, screen : LaunchScreen
}

Full launch metadata delivered to `init`.

Values

launchReasonFromTag

launchReasonFromTag : Int -> LaunchReason

Decode an integer launch tag into a `LaunchReason`.

launchReasonToInt

launchReasonToInt : LaunchReason -> Int

Encode a `LaunchReason` into the integer tag used by the native runtime.

watchface

watchface : { init : LaunchContext -> ( model, Cmd msg )
, update : msg -> model -> ( model, Cmd msg )
, view : model -> view
, subscriptions : model -> Sub msg
}
-> Program Decode.Value model msg

Start a Pebble watchface.

`config.init` receives a typed launch context. `view` is retained as the watch rendering contract, while init/update/subscriptions are forwarded to Elm's headless `Platform.worker`.

application

application : { init : LaunchContext -> ( model, Cmd msg )
, update : msg -> model -> ( model, Cmd msg )
, view : model -> view
, subscriptions : model -> Sub msg
}
-> Program Decode.Value model msg

Start a Pebble watch application.

Use this for apps rather than watchfaces. It currently has the same runtime shape as `watchface`, but keeps the app/watchface distinction explicit for build tooling.