Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/thoughtbot/expirable
Manage values that expire after a period of time.
https://github.com/thoughtbot/expirable
elm elm-lang
Last synced: 2 months ago
JSON representation
Manage values that expire after a period of time.
- Host: GitHub
- URL: https://github.com/thoughtbot/expirable
- Owner: thoughtbot
- License: mit
- Created: 2018-06-29T19:19:10.000Z (over 6 years ago)
- Default Branch: main
- Last Pushed: 2021-09-24T16:06:40.000Z (about 3 years ago)
- Last Synced: 2024-09-30T05:23:01.717Z (3 months ago)
- Topics: elm, elm-lang
- Language: Elm
- Homepage: http://package.elm-lang.org/packages/thoughtbot/expirable/latest
- Size: 40 KB
- Stars: 6
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Expirable
Manage values that expire after a period of time.
## Example
```elm
import Expirable exposing (Expirable)type alias Model =
{ toastMessages : List (Expirable String)
}type Msg
= DecrementToastMessages Time.Posixinitial : 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 DecrementToastMessagesupdate : Msg -> Model -> ( Model, Cmd Msg )
update msg model =
case msg of
DecrementToastMessages time ->
( { model
| toastMessages = Expirable.tickAll time model.toastMessages
}
, Cmd.none
)
```## Development
To set up a working development environment, run:
```sh
yarn
```Ensure that this project's `node_modules/.bin` is at the beginning
of your `$PATH`, ensuring that any local NPM packages have the
highest priority.To ensure the package compiles:
```sh
yarn build
```To run tests:
```sh
yarn test
```## License
See the [LICENSE](/LICENSE) file.
## About thoughtbot
![thoughtbot](http://presskit.thoughtbot.com/images/thoughtbot-logo-for-readmes.svg)
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][community] or
[hire us][hire] to design, develop, and grow your product.[community]: https://thoughtbot.com/community?utm_source=github
[hire]: https://thoughtbot.com/hire-us?utm_source=github