Sha256: 78d9bbfc755ef1d6e8fa960955379eaa8e26d3ed517f31e9ef79531529bcc95e

Contents?: true

Size: 1.16 KB

Versions: 7

Compression:

Stored size: 1.16 KB

Contents

/**
 * @class ExtMVC.Presenter
 * @extends Ext.util.Observable
 * Used as an interface between a controller and its views
 */
ExtMVC.Presenter = Ext.extend(Ext.util.Observable, {

  constructor: function(config) {
    ExtMVC.Presenter.superclass.constructor.apply(this, arguments);
    
    this.addEvents(
      /**
       * @event load
       * Fires when all items in the Presenter have been loaded
       */
      'load'
    );
    
    /**
     * @property loaded
     * @type Boolean
     * True if all items that must be loaded before rendering have been
     */
    this.loaded = false;
    
    /**
     * @property loading
     * @type Boolean
     * True while the loader is loading
     */
    this.loading = false;
  },
  
  load: function() {
    if (this.loaded || this.loading) return;
    
    this.each(function(item, index, length) {
      var callback = function(index) {
        return function() {
          if (index == length) {
            this.loaded = true;
            this.loading = false;
            
            this.fireEvent('load');
          }
        };
      }(index);
      
      item.on('load', callback, this, {single: true});
    }, this);
  }
});

Version data entries

7 entries across 6 versions & 1 rubygems

Version Path
extjs-mvc-0.4.0.k lib/extjs-mvc/src/Presenter.js
extjs-mvc-0.4.0.k test/app/vendor/extjs-mvc/Presenter.js
extjs-mvc-0.4.0.f lib/src/Presenter.js
extjs-mvc-0.4.0.e lib/vendor/Presenter.js
extjs-mvc-0.4.0.d lib/vendor/Presenter.js
extjs-mvc-0.4.0.b lib/js/Presenter.js
extjs-mvc-0.4.0.a lib/js/Presenter.js