An open API service indexing awesome lists of open source software.

https://github.com/lpil/repeatedly


https://github.com/lpil/repeatedly

Last synced: 10 months ago
JSON representation

Awesome Lists containing this project

README

          

# repeatedly

Call a function repeatedly with a delay between each call.

[![Package Version](https://img.shields.io/hexpm/v/repeatedly)](https://hex.pm/packages/repeatedly)
[![Hex Docs](https://img.shields.io/badge/hex-docs-ffaff3)](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 .