No description
Find a file
2025-03-16 15:13:28 +00:00
.github/workflows Hello, Joe! 2024-01-05 14:23:25 +00:00
src Stop bug 2024-10-21 15:02:53 +01:00
test Stop bug 2024-10-21 15:02:53 +01:00
.gitignore Hello, Joe! 2024-01-05 14:23:25 +00:00
CHANGELOG.md v2.1.2 2024-10-21 15:03:35 +01:00
gleam.toml v2.1.2 2024-10-21 15:03:35 +01:00
manifest.toml Hello, Joe! 2024-01-05 14:23:25 +00:00
README.md Update README.md 2025-03-16 15:13:28 +00:00

repeatedly

Call a function repeatedly with a delay between each call.

Package Version Hex Docs

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.

gleam add repeatedly
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 https://hexdocs.pm/repeatedly.