Dongle/Events API

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
==DongleObject:RegisterEvent(event, func)==
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.
===Arguments===
* 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.
===Callback Signature===
* func(event, ...)
* DongleObject[func](DongleObject, event, ...)
===Behavior===
* 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
==DongleObject:UnregisterEvent(event)==
Unregisters the given event for this object, if registered.
===Arguments===
* event (string) - The name of the blizzard event, such as "UNIT_HEALTH"
==DongleObject:UnregisterAllEvents()==
Unregisters all events for this object.
Category:Dongle