Dongle/Events API

< Dongle

104,672pages on
this wiki
Add New Page
Talk0 Share

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)Edit

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.

Callback SignatureEdit

  • 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.

Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.

Also on Fandom

Random Wiki