[{"name":"Loadable","comment":" This package allows you to separate the initial loading of resources in an Elm program\nfrom the rest of the logic of your application.\n\nExample: Let's say you have an Elm application that depends on a JSON payload being loaded.\nBy separating the initial load process from the rest of your application, it allows you to simplify all subsequent code\nin your application because you no longer have to deal with as many Maybe values, therefore reducing the complexity and number\nof code paths.\n\n    import Animal\n    import Help.Loadable as L\n    import Html exposing (text)\n    import Http\n    import Task exposing (Task)\n\n\n    -- Define your Flags as you normally would.\n    type alias Flags =\n        { frogID : Int\n        , birdID : Int\n        }\n\n    -- Define your Model, but without any unnecessary Maybe types.\n    type alias Model =\n        { frog : Int\n        , bird : Int\n        }\n\n    -- Define your Msg as you normally would.\n    type Msg\n        = Noop\n\n    -- Instead of using Browser.element directly, you can use Loadable.element to get back\n    -- a Program of Loadable Msg and Loadable Model which wraps your application.\n    -- There are some additional options that you can find documented below.\n    main : Program Flags (L.Model Flags Model Http.Error) (L.Msg Model Msg Http.Error)\n    main =\n        L.element\n            { update = \\msg model -> model\n            , subscriptions = subscriptions\n            , view = text \"\"\n            , load = load\n            , failCmd = Nothing\n            , loadingView = Nothing\n            , errorView = Nothing\n            }\n\n    subscriptions : Model -> Sub Msg\n    subscriptions model =\n        Sub.none\n\n    -- This is what sets a Loadable element apart from a normal Browser.element. You can join\n    -- however many Tasks you want together to return your starting (Model, Msg) when the page loads.\n    -- In the meantime, the `loadingView` you specify will display info to the user that the page is loading\n    -- and if anything fails, your `errorView` can be used to display an error message to the user.\n    load : Flags -> Task Http.Error ( Model, Cmd Msg )\n    load flags =\n        let\n            { birdID, frogID } =\n                flags\n\n            birdTask =\n                Animal.getByID birdID |> Http.toTask\n\n            frogTask =\n                Animal.getByID frogID |> Http.toTask\n        in\n        Task.map2\n            (\\bird frog ->\n                ( { bird = bird, frog = frog }\n                , Cmd.none\n                )\n            )\n            birdTask\n            frogTask\n\n\n# Definition\n\n@docs element, Model, Msg\n\n","unions":[{"name":"Model","comment":" The Model that wraps your Model. Can either be in a loading state, loaded state, or an error state (if the loading step fails.)\n","args":["flags","innerModel","e"],"cases":[]},{"name":"Msg","comment":" The Msg that wraps your Msg. LoadSuccess/LoadError triggers depending on the result of your load function. ToInner is the msg that\n-- passes all your program messages on to your update function.\n","args":["innerModel","msg","e"],"cases":[]}],"aliases":[],"values":[{"name":"element","comment":" Behaves a lot like element from the Html package, with a few additions.\n","type":"{ update : innerMsg -> innerModel -> ( innerModel, Platform.Cmd.Cmd innerMsg ), subscriptions : innerModel -> Platform.Sub.Sub innerMsg, view : innerModel -> Html.Html innerMsg, load : flags -> Task.Task e ( innerModel, Platform.Cmd.Cmd innerMsg ), failCmd : Maybe.Maybe (e -> Platform.Cmd.Cmd (Loadable.Msg innerModel innerMsg e)), loadingView : Maybe.Maybe (flags -> Html.Html (Loadable.Msg innerModel innerMsg e)), errorView : Maybe.Maybe (e -> Html.Html (Loadable.Msg innerModel innerMsg e)) } -> Platform.Program flags (Loadable.Model flags innerModel e) (Loadable.Msg innerModel innerMsg e)"}],"binops":[]}]