# Scheduler

## Summary

<table><thead><tr><th width="119">Type</th><th>Function</th></tr></thead><tbody><tr><td>Int</td><td><a href="#one_second">Enum.ONE_SECOND</a></td></tr><tr><td>Function</td><td><code>void</code> <a href="#schedule">Schedule</a>(<code>int</code> frameDelay, <code>function</code> callback, <code>any...</code> ...)</td></tr><tr><td>Function</td><td><code>void</code> <a href="#e">Empty</a>()</td></tr></tbody></table>

## Enumerators

### ONE\_SECOND

`int Enum.ONE_SECOND`

This is equal to 30, which is how many frames there are in a second.

## Methods

### Schedule()

`void Schedule(int frameDelay, function callback, any... ...)`

Schedule `callback` to run with all arguments provided (`...` is a [variadic argument](https://en.wikipedia.org/wiki/Variadic_function)) after `frameDelay` frames have passed.

<details>

<summary>Example</summary>

{% code overflow="wrap" lineNumbers="true" %}

```lua
local Scheduler = IsaacHelper.GetModule("Scheduler")

local function AwesomePrint(str, num)
    print(str)
    print("Oh also my favorite number is " .. num)
end

-- 4 seconds from now, AwesomePrint will run with the provided arguments.
Scheduler.Schedule(Scheduler.Enum.ONE_SECOND * 4, AwesomePrint, "Hey, wanna be friends?", 26)
```

{% endcode %}

</details>

### Empty()

`void Empty()`

Cancel all scheduled tasks. This is called internally when the game is exited or on gameover.
