User:Jacek Antonelli/Plugin System/Event Callbacks

Event Callbacks
Event callbacks allow plugins to receive notification when certain events occur, such as :
 * A nearby avatar saying something
 * The user pressing a keyboard key
 * The user receiving an inventory item
 * Or any of a number of other things

This allows the plugin to respond to these events when they happen. For example, a plugin could:
 * Export the incoming chat to a text-to-speech program to help users with limited vision
 * Provide shortcut key activated actions
 * Sort incoming inventory into an "Inbox" directory

Clearly, this is a powerful idea and an important component of the plugin system.

Registering for Events
In order for a plugin to receive events, it must first indicate its interest in particular event types by registering with the viewer for those types. When registering, the plugin specifies:

1. The event type it's interested in. 2. Optionally, which properties of the event it's interested in. 3. Optionally, a priority level for determining its order to receive the event, as described below.

Callback Order
TBW

Callback Types
There are two types of event callbacks, listeners and hooks. Both callbacks allow the plugin to receive event notification and act accordingly, but hooks go further, giving the plugin the opportunity to intercept or modify events that it receives.

Event Listeners
TBW

Event Hooks
TBW