+ *
+ * Ext.define('Employee', {
+ * extend: 'Ext.util.Observable',
+ * constructor: function(config){
+ * this.name = config.name;
+ * this.addEvents({
+ * "fired" : true,
+ * "quit" : true
+ * });
+ *
+ * // Copy configured listeners into *this* object so that the base class's
+ * // constructor will add them.
+ * this.listeners = config.listeners;
+ *
+ * // Call our superclass constructor to complete construction process.
+ * Employee.superclass.constructor.call(this, config)
+ * }
+ * });
+ *
+ * This could then be used like this:
+ *
+ * var newEmployee = new Employee({
+ * name: employeeName,
+ * listeners: {
+ * quit: function() {
+ * // By default, "this" will be the object that fired the event.
+ * alert(this.name + " has quit!");
+ * }
+ * }
+ * });
+ */
+Ext.define('Ext.util.Observable', {
+
+ /* Begin Definitions */
+
+ requires: ['Ext.util.Event'],
+
+ statics: {
+<span id='Ext-util-Observable-method-releaseCapture'> /**
+</span> * Removes **all** added captures from the Observable.
+ *
+ * @param {Observable} o The Observable to release
+ * @static
+ */
+ releaseCapture: function(o) {
+ o.fireEvent = this.prototype.fireEvent;
+ },
+
+<span id='Ext-util-Observable-method-capture'> /**
+</span> * Starts capture on the specified Observable. All events will be passed to the supplied function with the event
+ * name + standard signature of the event **before** the event is fired. If the supplied function returns false,
+ * the event will not fire.
+ *
+ * @param {Observable} o The Observable to capture events from.
+ * @param {Function} fn The function to call when an event is fired.
+ * @param {Object} scope (optional) The scope (`this` reference) in which the function is executed. Defaults to
+ * the Observable firing the event.
+ * @static
+ */
+ capture: function(o, fn, scope) {
+ o.fireEvent = Ext.Function.createInterceptor(o.fireEvent, fn, scope);
+ },
+
+<span id='Ext-util-Observable-method-observe'> /**
+</span> * Sets observability on the passed class constructor.
+ *
+ * This makes any event fired on any instance of the passed class also fire a single event through
+ * the **class** allowing for central handling of events on many instances at once.
+ *
+ * Usage:
+ *
+ * Ext.util.Observable.observe(Ext.data.Connection);
+ * Ext.data.Connection.on('beforerequest', function(con, options) {
+ * console.log('Ajax request made to ' + options.url);
+ * });
+ *
+ * @param {Function} c The class constructor to make observable.
+ * @param {Object} listeners An object containing a series of listeners to add. See {@link #addListener}.
+ * @static
+ */
+ observe: function(cls, listeners) {
+ if (cls) {
+ if (!cls.isObservable) {
+ Ext.applyIf(cls, new this());
+ this.capture(cls.prototype, cls.fireEvent, cls);
+ }
+ if (Ext.isObject(listeners)) {
+ cls.on(listeners);
+ }
+ return cls;
+ }
+ }
+ },