Class type Ext_util_Observable.t


class type t = object .. end
Inherits
method hasListeners : 'a. 'a Js.t Js.readonly_prop

This object holds a key for any event that has a listener. The listener may be set directly on the instance, or on its class or a super class (via observe) or on the MVC EventBus. The values of this object are truthy (a non-zero number) and falsy (0 or undefined). They do not represent an exact count of listeners. The value for an event is truthy if the event must be fired and is falsy if there is no need to fire the event.

The intended use of this property is to avoid the expense of fireEvent calls when there are no listeners. This can be particularly helpful when one would otherwise have to call fireEvent hundreds or thousands of times. It is used like this:

 if (this.hasListeners.foo) {
     this.fireEvent('foo', this, arg1);
 }

method isObservable : bool Js.t Js.prop

true in this class to identify an object as an instantiated Observable, or subclass thereof.

Defaults to: true

method addEvents : 'b. 'b Js.t -> unit Js.meth

Adds the specified events to the list of events which this Observable may fire.

Parameters:


method addListener : 'c 'd 'e 'f 'g.
'c Js.t ->
'd Js.callback Js.optdef ->
'e Js.t Js.optdef -> 'f Js.t Js.optdef -> 'g Js.t Js.meth

Appends an event handler to this object. For example:

myGridPanel.on("mouseover", this.onMouseOver, this);

The method also allows for a single argument to be passed which is a config object containing properties which specify multiple events. For example:

myGridPanel.on({
    cellClick: this.onCellClick,
    mouseover: this.onMouseOver,
    mouseout: this.onMouseOut,
    scope: this // Important. Ensure "this" is correct during handler execution
});

One can also specify options for each event handler separately:

myGridPanel.on({
    cellClick: {fn: this.onCellClick, scope: this, single: true},
    mouseover: {fn: panel.onMouseOver, scope: panel}
});

Names of methods in a specified scope may also be used. Note that scope MUST be specified to use this option:

myGridPanel.on({
    cellClick: {fn: 'onCellClick', scope: this, single: true},
    mouseover: {fn: 'onMouseOver', scope: panel}
});

Parameters:

Returns:


method addManagedListener : 'h 'i 'j 'k 'l 'm.
'h Js.t ->
'i Js.t ->
'j Js.callback Js.optdef ->
'k Js.t Js.optdef -> 'l Js.t Js.optdef -> 'm Js.t Js.meth

Adds listeners to any Observable object (or Ext.Element) which are automatically removed when this Component is destroyed.

Parameters:

Returns:


method clearListeners : unit Js.meth

Removes all listeners for this object including the managed listeners


method clearManagedListeners : unit Js.meth

Removes all managed listeners for this object.


method enableBubble : 'n. 'n Js.t -> unit Js.meth

Enables events fired by this Observable to bubble up an owner hierarchy by calling this.getBubbleTarget() if present. There is no implementation in the Observable base class.

This is commonly used by Ext.Components to bubble events to owner Containers. See Ext.Component.getBubbleTarget. The default implementation in Ext.Component returns the Component's immediate owner. But if a known target is required, this can be overridden to access the required target more quickly.

Example:

Ext.define('Ext.overrides.form.field.Base', {
    override: 'Ext.form.field.Base',

    //  Add functionality to Field's initComponent to enable the change event to bubble
    initComponent: function () {
        this.callParent();
        this.enableBubble('change');
    }
});

var myForm = Ext.create('Ext.form.Panel', {
    title: 'User Details',
    items: [{
        ...
    }],
    listeners: {
        change: function() {
            // Title goes red if form has been modified.
            myForm.header.setStyle('color', 'red');
        }
    }
});

Parameters:


method fireEvent : 'o. Js.js_string Js.t -> 'o Js.t -> bool Js.t Js.meth

Fires the specified event with the passed parameters (minus the event name, plus the options object passed to addListener).

An event may be set to bubble up an Observable parent hierarchy (See Ext.Component.getBubbleTarget) by calling enableBubble.

Parameters:

Returns:


method fireEventArgs : 'p. Js.js_string Js.t -> 'p Js.t Js.js_array Js.t -> bool Js.t Js.meth

Fires the specified event with the passed parameter list.

An event may be set to bubble up an Observable parent hierarchy (See Ext.Component.getBubbleTarget) by calling enableBubble.

Parameters:

Returns:


method hasListener : Js.js_string Js.t -> bool Js.t Js.meth

Checks to see if this object has any listeners for a specified event, or whether the event bubbles. The answer indicates whether the event needs firing or not.

Parameters:

Returns:


method mon : 'q 'r 's 't 'u 'v.
'q Js.t ->
'r Js.t ->
's Js.callback Js.optdef ->
't Js.t Js.optdef -> 'u Js.t Js.optdef -> 'v Js.t Js.meth

Shorthand for addManagedListener.

Adds listeners to any Observable object (or Ext.Element) which are automatically removed when this Component is destroyed.

Parameters:

Returns:


method mun : 'w 'x 'y 'z.
'w Js.t ->
'x Js.t -> 'y Js.callback Js.optdef -> 'z Js.t Js.optdef -> unit Js.meth

Shorthand for removeManagedListener.

Removes listeners that were added by the mon method.

Parameters:


method on : 'a1 'b1 'c1 'd1 'e1.
'a1 Js.t ->
'b1 Js.callback Js.optdef ->
'c1 Js.t Js.optdef -> 'd1 Js.t Js.optdef -> 'e1 Js.t Js.meth

Shorthand for addListener.

Appends an event handler to this object. For example:

myGridPanel.on("mouseover", this.onMouseOver, this);

The method also allows for a single argument to be passed which is a config object containing properties which specify multiple events. For example:

myGridPanel.on({
    cellClick: this.onCellClick,
    mouseover: this.onMouseOver,
    mouseout: this.onMouseOut,
    scope: this // Important. Ensure "this" is correct during handler execution
});

One can also specify options for each event handler separately:

myGridPanel.on({
    cellClick: {fn: this.onCellClick, scope: this, single: true},
    mouseover: {fn: panel.onMouseOver, scope: panel}
});

Names of methods in a specified scope may also be used. Note that scope MUST be specified to use this option:

myGridPanel.on({
    cellClick: {fn: 'onCellClick', scope: this, single: true},
    mouseover: {fn: 'onMouseOver', scope: panel}
});

Parameters:

Returns:


method relayEvents : 'f1 'g1.
'f1 Js.t ->
Js.js_string Js.t Js.js_array Js.t ->
Js.js_string Js.t Js.optdef -> 'g1 Js.t Js.meth

Relays selected events from the specified Observable as if the events were fired by this.

For example if you are extending Grid, you might decide to forward some events from store. So you can do this inside your initComponent:

this.relayEvents(this.getStore(), ['load']);

The grid instance will then have an observable 'load' event which will be passed the parameters of the store's load event and any function fired with the grid's load event would have access to the grid using the this keyword.

Parameters:

Returns:


method removeListener : 'h1 'i1.
Js.js_string Js.t -> 'h1 Js.callback -> 'i1 Js.t Js.optdef -> unit Js.meth

Removes an event handler.

Parameters:


method removeManagedListener : 'j1 'k1 'l1 'm1.
'j1 Js.t ->
'k1 Js.t -> 'l1 Js.callback Js.optdef -> 'm1 Js.t Js.optdef -> unit Js.meth

Removes listeners that were added by the mon method.

Parameters:


method resumeEvent : Js.js_string Js.t -> unit Js.meth

Resumes firing of the named event(s).

After calling this method to resume events, the events will fire when requested to fire.

Note that if the suspendEvent method is called multiple times for a certain event, this converse method will have to be called the same number of times for it to resume firing.

Parameters:


method resumeEvents : unit Js.meth

Resumes firing events (see suspendEvents).

If events were suspended using the queueSuspended parameter, then all events fired during event suspension will be sent to any listeners now.


method suspendEvent : Js.js_string Js.t -> unit Js.meth

Suspends firing of the named event(s).

After calling this method to suspend events, the events will no longer fire when requested to fire.

Note that if this is called multiple times for a certain event, the converse method resumeEvent will have to be called the same number of times for it to resume firing.

Parameters:


method suspendEvents : bool Js.t -> unit Js.meth

Suspends the firing of all events. (see resumeEvents)

Parameters:


method un : 'n1 'o1.
Js.js_string Js.t -> 'n1 Js.callback -> 'o1 Js.t Js.optdef -> unit Js.meth

Shorthand for removeListener.

Removes an event handler.

Parameters: