LibCooldown-Spell-2.0
From WowAce Wiki
| Summary | |
|---|---|
| Lib: Cooldown-Spell-2.0 | |
| Register spell cooldowns to more descriptive events. | |
| TOC | 2.4 (20400) |
| Category | Libraries |
| Author | Sirow |
| Details | |
| Version | 2.0 |
| OptionalDeps | LibStub, CallbackHandler-1.0, LibSimpleTimer-1.0, LibGratuity-3.0, LibBabble-Zone-3.0 |
| Links | |
| Betas | Ace SVN Zip |
| Changelog | FishEye |
Contents
|
LibCooldown-Spell-2.0 - API Documentation
Callbacks Fired
:LibCooldownSpell_Start(spellName , spellID, startTime, duration)
Arguments
- spellName
- string - Name of triggered spell
- spellID
- number - ID of spell in spellbook (as used by GetSpellName(spellID, bookType)
- startTime
- number - Time when cooldown started (as returned by GetTime())
- duration
- number - Duration of cooldown until finished
Notes
- Fired whenever one of your spell cooldowns was started
:LibCooldownPetSpell_Start(spellName , spellID, startTime, duration)
Arguments
- spellName
- string - Name of triggered spell
- spellID
- number - ID of spell in spellbook (as used by GetSpellName(spellID, bookType)
- startTime
- number - Time when cooldown started (as returned by GetTime())
- duration
- number - Duration of cooldown until finished
Notes
- Fired whenever one of your pets spell cooldowns was started
:LibCooldownSpell_End(spellName , spellID, startTime, duration)
Arguments
- spellName
- string - Name of triggered spell
- spellID
- number - ID of spell in spellbook (as used by GetSpellName(spellID, bookType)
- startTime
- number - Time when cooldown started (as returned by GetTime())
- duration
- number - Duration of cooldown until finished
Notes
- Fired whenever one of your spell cooldowns has finished
:LibCooldownPetSpell_End(spellName , spellID, startTime, duration)
Arguments
- spellName
- string - Name of triggered spell
- spellID
- number - ID of spell in spellbook (as used by GetSpellName(spellID, bookType)
- startTime
- number - Time when cooldown started (as returned by GetTime())
- duration
- number - Duration of cooldown until finished
Notes
- Fired whenever one of your pets spell cooldowns has finished
CallbackHandler-1.0 API
:RegisterEvent()
myAddon:RegisterEvent("eventName"[, method[, arg]])
library.RegisterEvent(myTable, "eventName"[, method[, arg]])
library.RegisterEvent("myAddonId", "eventName"[, method[, arg]])
- "eventName"
- (string) - the name of the event you want to listen to
- method
- (string or function) - which method to call. If string, self["method"] will be called. If left out (nil), self["eventName"] will be called.
- arg
- (optional) - If present (even nil), this value will be passed to the receiving function.
Registrations are always associated with the supplied self. This means that you'll want to embed the library, or do the call like .RegisterEvent(myTable, ...). Note the use of " . " (period) rather than " : " (colon).
If you do not have a sane self table to associate your registrations with, you can substitute it for a string. Note the use of "." rather than ":".
-
library.RegisterEvent("myAddonId", "eventName", ...)
This string variant of a self will not be passed to the receiving function.
Callback arguments
If the method is a plain function, it will be called as:
-
method("eventName", (arguments to the event)) - or, with an arg specified when registering:
-
method(arg, "eventName", (arguments to the event))
If the method is a string (method name), it will be called as:
-
self["method"](self, "eventName", (arguments to the event)) - or, with an arg specified when registering:
-
self["method"](self, arg, "eventName", (arguments to the event))
:UnregisterEvent()
myAddon:UnregisterEvent("eventName")
library.UnregisterEvent(myTable, "eventName")
library.UnregisterEvent("myAddonId", "eventName")
- "eventName"
- the name of the event that you no longer wish to receive.
Note that the supplied self must match the self supplied to :RegisterEvent(), or nothing will be unregistered.
:UnregisterAllEvents()
:UnregisterAllEvents()
library.UnregisterAllEvents("myAddonId", myTable, ...)
UnregisterAllEvents will unregister all events associated with the given self, as well as with additional arguments given.

