This is an alternative site for discovering Elm packages. You may be looking for the official Elm package site instead.
2.0.0
Manage values that expire after a period of time
version 1.0.0
license MIT
native-modules False
elm-version 0.18.0 <= v < 0.19.0
Tag 1.0.0
Committed At 2018-06-29 21:40:17 UTC
elm-lang/core 5.0.0 <= v < 6.0.0 5.1.1

Modules

README

Expirable

Manage values that expire after a period of time.

Example

import Expirable exposing (Expirable)


type alias Model =
    { toastMessages : List (Expirable String)
    }


type Msg
    = DecrementToastMessages Time.Time


initial : Model
initial =
    { toastMessages =
        [ Expirable.build (Expirable.seconds 5) "Hi there"
        , Expirable.build (Expirable.seconds 30) "This goes longer"
        ]
    }


subscriptions : Model -> Sub Msg
subscriptions model =
    Expirable.subscription DecrementToastMessages


update : Msg -> Model -> ( Model, Cmd Msg )
update msg model =
    case msg of
        DecrementToastMessages time ->
            { model
                | toastMessages = Expirable.tickAll time model.toastMessages
            }
                ! []

License

See the LICENSE file.

About thoughtbot

thoughtbot

Expirable is maintained and funded by thoughtbot, inc. The names and logos for thoughtbot are trademarks of thoughtbot, inc.

We love open source software! See our other projects or hire us to design, develop, and grow your product.