This is an alternative site for discovering Elm packages. You may be looking for the official Elm package site instead.
Disconnected views exploration.
version 1.0.0
license BSD3
native-modules False
elm-version 0.18.0 <= v < 0.19.0
Tag 1.0.0
Committed At 2017-07-16 14:07:25 UTC
elm-lang/html 2.0.0 <= v < 3.0.0 2.0.0
elm-lang/core 5.1.1 <= v < 6.0.0 5.1.1

Modules

README

Elm Disconnected views explorations

view : View Store msg
view =
    with q.items <|
        \items ->
            List.map renderTodo items |> div []


renderTodo : String -> View Store msg
renderTodo item =
    with q.intro <|
        \intro ->
            div []
                [ text intro
                , text item
                ]

The idea is that views can be explicitly asked for some info, but can also ask for info themselves.

This works through queries that know how to extract some info from a store:

type alias Store =
    { todo : List String
    , otherThing : String
    }


q :
    { items : Query Store (List String)
    , intro : Query Store String
    }
q =
    { items = .todo >> List.reverse
    , intro = .otherThing
    }

The "secret" here is that the store is actually passed around, you just can't access it. Not directly. Tadaa.