Lore archive · Warcraft Wiki, 2023 dump
Dongle/Events API
Last wiki revision 2007-06-07
Dongle provides a very simple API for registering a callback function for a given blizzard event. This gives you an easy way to call functions as methods within your object without needing to create closures.
This API was introduced with Dongle-1.0
Register a callback for the given blizzard event. These handlers are not called in a predictable order, so don't rely on temporal registration to enforce behavior.
- event (string) - The name of the blizzard event, such as "UNIT_HEALTH"
- func (function, string) - A function to be called, or the name of a method to call within the DongleObject.
- func(event, ...)
- DongleObject[func](DongleObject, event, ...)
- If func is specified as a function, the DongleObject is not passed as the first argument, the handler will only receive the arguments generated by the event.
- If func is a string, then DongleObject[func] is called with DongleObject as the first argument, along with the event's arguments.
- Although the frame which generates the event is available to the dispatcher, this information is not passed to the handlers.
- Each dongle object may only register for each event once
Unregisters the given event for this object, if registered.
- event (string) - The name of the blizzard event, such as "UNIT_HEALTH"
Unregisters all events for this object.
Categories
- Dongle
Source
https://warcraft.wiki.gg/wiki/Dongle/Events_API · retrieved 2023-11-13 · CC BY-SA 4.0
Converted from wikitext with templates, tables and images removed, so some sentences may be missing values.
This archive predates WoW: Forever. For collected gameplay facts see the Forever database. Search the archive.