(function(app) {
  'use strict';

  var jCore = require('jcore');
  var helper = app.helper || require('../helper.js');
  var dom = app.dom || require('../dom.js');

  var Button = helper.inherits(function(props) {
    Button.super_.call(this);

    this.isActive = this.prop(false);
    this.element = this.prop(props.element);
    this.cache = this.prop({});
  }, jCore.Component);

  Button.prototype.redraw = function() {
    this.redrawIsActive();
  };

  Button.prototype.redrawIsActive = function() {
    var isActive = this.isActive();
    var cache = this.cache();

    if (isActive === cache.isActive)
      return;

    dom.toggleClass(this.element(), 'active', isActive);
    cache.isActive = isActive;
  };

  if (typeof module !== 'undefined' && module.exports)
    module.exports = Button;
  else
    app.Button = Button;
})(this.app || (this.app = {}));

(function(app) {
  'use strict';

  var jCore = require('jcore');
  var helper = app.helper || require('../helper.js');
  var dom = app.dom || require('../dom.js');

  var Button = helper.inherits(function(props) {
    Button.super_.call(this);

    this.isActive = this.prop(false);
    this.disabled = this.prop(false);
    this.element = this.prop(props.element);
    this.cache = this.prop({});
  }, jCore.Component);

  Button.prototype.redraw = function() {
    this.redrawIsActive();
    this.redrawDisabled();
  };

  Button.prototype.redrawIsActive = function() {
    var isActive = this.isActive();
    var cache = this.cache();

    if (isActive === cache.isActive)
      return;

    dom.toggleClass(this.element(), 'active', isActive);
    cache.isActive = isActive;
  };

  Button.prototype.redrawDisabled = function() {
    var disabled = this.disabled();
    var cache = this.cache();

    if (disabled === cache.disabled)
      return;

    dom.disabled(this.element(), disabled);
    cache.disabled = disabled;
  };

  if (typeof module !== 'undefined' && module.exports)
    module.exports = Button;
  else
    app.Button = Button;
})(this.app || (this.app = {}));

Add property to disable a button