From KickApps Documentation
To see a live example of this event API in action, please refer to our Facebook Connect plugin.
Previously, developers often would overwrite our functions with their own, allowing them to control the flow and behavior of the application. This meant that any time we updated our code, these communities would not be using the updated functions.
Note: Our event system is an instance of our ObserverClass and is located in the Ka.events namespace.
Please refer to the list of events currently supported for further information about them, and specific usage for each.
The following describes the public methods of the ObserverClass. Examples are provided for each method on a separate page.
- Listens for the specified event and fires the specified callback upon dispatch of the event.
<int> Ka.events.listen(<string> eventName, <function> callback, [object] options)
- Event to listen for
- Callback to fire upon dispatch of specified event
- Additional Options
- (Optional) You may optionally provide additional options for more precise control over your event handler. The following options are supported, but not required.
- Provides the option of setting the scope of the '''this''' keyword in your event handler.
- Allows you to specify which browser this event handler will run on. You may specify "MSIE", "Safari", "Mozilla" or "Opera".
- In conjunction with browser, this allows you to target a specific version of a specific browser.
- Removes an event from the event queue. You can remove an event by ID, by event name, or by passing the callback function of the event you want to remove. Removing by ID removes only the event handler that matches that ID. Removing by event name or callback removes all events handlers that match that event name or callback.
<void> Ka.events.remove(<string> eventName)
<void> Ka.events.remove(<function> callback)
<void> Ka.events.remove(<int> eventId)
- Name of the event handler to be removed
- Callback function of the event handler to be removed
- ID of the event handler to be removed
- Dispatches an event by name, passing optional additional arguments if neccessary.
<bool> Ka.events.dispatchEvent(<string> eventName, [object] additionalArguments)
- Event to be dispatched
Ka.Settings.enableLogging = true;