WaitTimer

Intro
This small library provides an easy way to generate timed events.

You can setup a delayed or repeated function call without messing around with a dummy frame and OnUpdate events.

Setup
Copy theses files to your addon or any subdirectory of it LibStub.lua WaitTimer.lua Usually people will use a "lib" subdirectory

Add them at the beginning of your .toc file to make sure they get loaded.

Init
local WaitTimer = LibStub("WaitTimer") put it at the beginnig of your lua file where you want to use the WaitTimer.

Usage
timer_id = WaitTimer.Wait(seconds, function, id, data)
 * seconds = how long to wait
 * function = will be called when time is elapsed if the function returns a value, this value is used as new wait_time.
 * id = (optional) a fixed timer id If another timer with the same ID exists it will be replaced
 * data = (optional) will be passed to the function call
 * timer_id = id which can be used in the other functions It's equal "id" when it was provided

WaitTimer.Stop(id)
 * stops the timer without calling the function

waittime = WaitTimer.Remaining(id)
 * @return remaining seconds or nil

WaitTimer.SetTime(id, delay)
 * reset the wait time
 * if is ommited the function will be triggert on next update