https://github.com/lpil/repeatedly
https://github.com/lpil/repeatedly
Last synced: 10 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/lpil/repeatedly
- Owner: lpil
- Created: 2024-01-05T14:23:39.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2025-03-16T15:13:28.000Z (about 1 year ago)
- Last Synced: 2025-06-14T22:16:20.280Z (11 months ago)
- Language: Gleam
- Size: 14.6 KB
- Stars: 12
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
# repeatedly
Call a function repeatedly with a delay between each call.
[](https://hex.pm/packages/repeatedly)
[](https://hexdocs.pm/repeatedly/)
Works on both Erlang and JavaScript runtimes! This means it's good for little scripts,
but if you're writing a full OTP program then this isn't the right library to use, and
something that exposes OTP compatible APIs would be better.
```sh
gleam add repeatedly
```
```gleam
import repeatedly
pub fn main() {
// Print every 500ms
let repeater = repeatedly.call(500, Nil, fn(_state, i) {
io.println("Call number " <> int.to_string(i))
})
// And at some point later, stop it
repeatedly.stop(repeater)
}
```
Further documentation can be found at .