2
* @fileOverview Contains the class definition for an UIElement class.
3
* @author <a href="mailto:patrick.schmiedel@gmx.net">Patrick Schmiedel</a>
6
var UIElement = Class.create(
7
/** @lends UIElement.prototype */
10
* @description Enables inheriting classes to use the "event/notification" system
13
initialize: function () {},
16
* @description Adds an event observer
17
* @param {String} eventName The name of the event to look for
18
* @param {Function} callback The function to execute when the event occurs
20
addObserver: function (eventName, callback) {
21
if (!this.observers) {
24
if (!this.observers[eventName]) {
25
this.observers[eventName] = $A([]);
27
this.observers[eventName].push(callback);
32
* @describe Fires a specific event
33
* @param {String} eventName The name of the event to trigger
34
* @param {Object} eventParameters The parameters to pass along with the event
36
fire: function (eventName, eventParameters) {
37
//$('output').innerHTML = eventName + ': ' + eventParameters;
38
if (!this.observers || !this.observers[eventName] || this.observers[eventName].length === 0) {
41
this.observers[eventName].each(function (callback) {
42
callback(eventParameters);
b'\\ No newline at end of file'