Pebble.Companion.Storage

Persistent companion storage helpers.

Values and errors

Value

type Value
    = StringValue String
    | IntValue Int
    | BoolValue Bool
    | JsonValue Encode.Value

A stored companion value.

Error

type Error
    = BridgeFailure BridgeError
    | MissingPayload
    | DecodeFailure String

Errors reported while reading companion storage.

Commands

set

set : String -> Value -> Cmd msg

Store a value under a key.

get

get : String -> (Result Error Value -> msg) -> Cmd msg

Read a stored value and deliver it to toMsg.

remove

remove : String -> Cmd msg

Remove a stored key.

clear

clear : Cmd msg

Clear all stored values.

setup

setup : Cmd msg

Register the storage platform handler with the companion bridge.

Subscriptions

onStorage

onStorage : (Result Error Value -> msg) -> Sub msg

Receive storage command responses routed through the platform bridge.