Wikia

WoWWiki

Dongle/Events API

Talk0
102,089pages on
this wiki

< Dongle

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.

ArgumentsEdit

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

BehaviorEdit

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

Unregisters the given event for this object, if registered.

ArgumentsEdit

  • event (string) - The name of the blizzard event, such as "UNIT_HEALTH"

DongleObject:UnregisterAllEvents()Edit

Unregisters all events for this object.

Around Wikia's network

Random Wiki