LibSimpleTimer-1.0
From WowAce Wiki
| Summary | |
|---|---|
| Lib: SimpleTimer-1.0 | |
| A Simple Timer | |
| TOC | 2.3 (20300) |
| Category | Libraries |
| Author | Whitetooth |
| Details | |
| Credits | Dongle Development Team |
| Links | |
| Betas | Ace SVN Zip |
| Changelog | FishEye |
Contents |
[edit]
Features
- Schedule/Cancel one-time or repeating timer by id.
- Able to schedule a timer without any callback. Why? Used with :IsTimerScheduled(id) for checks
- Able to overwrite existing timer.
- Fast OnUpdate utilizing a heap.
- Embedable.
[edit]
API Documentation
Note: This documentation is auto-generated. Please note that direct modifications may be overwritten on next autogenerate.
[edit]
:CancelTimer(name)
[edit]
Arguments
- name
- name (variant) - The name of the timer to cancel.
[edit]
Notes
- Cancels the timer scheduled with name.
[edit]
:Embed(target)
[edit]
Arguments
- target
- target (table) - The table with which to export methods onto.
[edit]
Notes
- Embeds "ScheduleTimer", "ScheduleRepeatingTimer", "IsTimerScheduled", "CancelTimer"
[edit]
Returns
The table provided, after embedding.
[edit]
:IsTimerScheduled(name)
[edit]
Arguments
- name
- name (variant) - The name of the timer to query.
[edit]
Notes
- Returns if the timer with the name specified is scheduled or not and also returns the time remaining for it to expire.
[edit]
Returns
false - if the timer is not scheduled. true, seconds (number) - if the timer is scheduled. seconds is the number of seconds required for the timer to expire.
[edit]
:ScheduleRepeatingTimer(name , func , delay , ...)
[edit]
Arguments
- name
- name (variant) - The name of the timer to be scheduled. You can use this name to check if this timer's status and/or cancel it.
- func
- func (function) - A function to be called when the timer expires.
- delay
- delay (number) - The number of seconds it takes for this timer to expire.
- ...
- ... - Any additional arguments to pass to the callback.
[edit]
Notes
- Schedule a repeating timer that expires every delay seconds.
- If you try to schedule a timer with the same name a second time, the old schedule will be overwritten.
[edit]
:ScheduleTimer(name , func , delay , ...)
[edit]
Arguments
- name
- name (variant) - The name of the timer to be scheduled. You can use this name to check if this timer's status and/or cancel it.
- func
- func (function or nil) - A function to be called when the timer expires, can be nil.
- delay
- delay (number) - The number of seconds it takes for this timer to expire.
- ...
- ... - Any additional arguments to pass to the callback.
[edit]
Notes
- Schedule a timer to expire in delay seconds at which point it will call the callback func. name is an identifier for this timer.
- If you try to schedule a timer with the same name a second time, the old schedule will be overwritten.
[edit]
Example
:ScheduleTimer("EncounterEnd", self.EncounterEnd, 10, self, 10)
:ScheduleTimer("EncounterEnd", nil, 10) -- why? used with :IsTimerScheduled("EncounterEnd")

