Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/iodevs/elm-history
A history pattern for Elm
https://github.com/iodevs/elm-history
elm hacktoberfest
Last synced: 21 days ago
JSON representation
A history pattern for Elm
- Host: GitHub
- URL: https://github.com/iodevs/elm-history
- Owner: iodevs
- License: other
- Created: 2018-10-02T19:21:56.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2018-10-05T12:33:57.000Z (about 6 years ago)
- Last Synced: 2023-08-08T20:39:25.717Z (over 1 year ago)
- Topics: elm, hacktoberfest
- Language: Elm
- Homepage:
- Size: 8.79 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# elm-history
This library helps with keeping history of states of your variables.
For example, you defined a width of some div (elm-css or style or ...) and
this width has been changed by user's action. After that you want to have
same width of div as before user's action.Install package usually a way (elm-0.19):
```
elm install iodevs/elm-history
```## Usage:
```haskell
import History exposing (History, create, forward, rewind, rewindAll)boxWidth : History String
boxWidth =
create "200px"newBoxWidth =
boxWidth
|> forward "300px" -- History "300px" ["200px"]
|> forward "400px" -- History "400px" ["300px", "200px"]
|> forward "500px" -- History "500px" ["400px", "300px", "200px"]
|> rewind -- History "400px" ["300px","200px"]
|> rewindAll -- History "200px" []
|> current -- "200px"
```