Elm Pebble

Pebble.Companion.Storage

Persistent key/value storage through the phone companion bridge.

import Pebble.Companion.Storage as Storage

saveHighScore =
    Storage.set "score-save" "high-score" (Storage.IntValue 9001)

Values and errors

Commands

Results

Union Types

Value

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

Values that can be stored by the companion bridge.

Error

type Error
type Error
    = BridgeFailure BridgeError
    | MissingPayload
    | DecodeFailure String

Storage result errors.

Values

set

set : String -> String -> Value -> CommandEnvelope

Store a value under a key.

get

get : String -> String -> CommandEnvelope

Request a value by key.

remove

remove : String -> String -> CommandEnvelope

Remove a value by key.

clear

clear : String -> CommandEnvelope

Remove all stored values.

decodeGet

decodeGet : ResultEnvelope -> Result Error Value

Decode the result of a `get` command.