Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default Unit #15

Merged
merged 3 commits into from
Mar 1, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions .github/workflows/tests.yml → .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Integration Tests
name: Run Tests, Verify Docs and Examples

on:
push:
Expand All @@ -9,7 +9,7 @@ on:
- main

jobs:
run-tests:
verify:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand All @@ -25,4 +25,6 @@ jobs:
restore-keys: ${{ runner.os }}-elm-

- run: npm ci
- run: npm run test
- run: npm run test
- run: npm run docs:verify
- run: npm run examples:build
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ node_modules
# build
dist
tests/program/index.js
docs.json

# editor
.idea
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ To trigger a single update after a period of time pass `Delay.after` as a comman
```elm
FirstMessage ->
( model
, Delay.after 500 Millisecond SecondMessage
, Delay.after 500 SecondMessage
)
```

Expand All @@ -31,9 +31,9 @@ After triggering `FirstMessage`, `500ms` later update will be called with `Secon
Trigger ->
( model
, Delay.sequence
[ ( 1000, Millisecond, FirstMessage )
, ( 2000, Millisecond, SecondMessage )
, ( 1000, Millisecond, ThirdMessage )
[ ( 1000, FirstMessage )
, ( 2000, SecondMessage )
, ( 1000, ThirdMessage )
]
)
```
Expand All @@ -50,9 +50,9 @@ As a convenience if you'd only like to start a sequence if the model is in a par
Trigger ->
( model
, Delay.sequenceIf (not model.updating)
[ ( 1000, Millisecond, FirstMessage )
, ( 2000, Millisecond, SecondMessage )
, ( 1000, Millisecond, ThirdMessage )
[ ( 1000, FirstMessage )
, ( 2000, SecondMessage )
, ( 1000, ThirdMessage )
]
)
```
Expand All @@ -62,11 +62,11 @@ If you'd like all the steps to have the same unit of time, use the `Delay.withUn
```elm
Trigger ->
( model
, Delay.sequence <|
Delay.withUnit Millisecond
[ ( 1000, FirstMessage )
, ( 2000, SecondMessage )
, ( 1000, ThirdMessage )
, Delay.sequence
Delay.withUnit Delay.seconds
[ ( 1, FirstMessage )
, ( 2, SecondMessage )
, ( 1, ThirdMessage )
]
)
```
14 changes: 6 additions & 8 deletions examples/src/Main.elm
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,12 @@ init =
cycleColors : Model -> Cmd Msg
cycleColors model =
Delay.sequenceIf (not model.colorCycling)
(Delay.withUnit Delay.Millisecond
[ ( 0, ColorCycling True )
, ( 0, Red )
, ( 2000, Green )
, ( 2000, Blue )
, ( 2000, ColorCycling False )
]
)
[ ( 0, ColorCycling True )
, ( 0, Red )
, ( 2000, Green )
, ( 2000, Blue )
, ( 2000, ColorCycling False )
]



Expand Down
Loading