// Generated by CoffeeScript 1.4.0
(function() {
  var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
    __hasProp = {}.hasOwnProperty,
    __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };

  window.Controls.logs__log = (function(_super) {

    __extends(logs__log, _super);

    function logs__log() {
      this.add = __bind(this.add, this);
      return logs__log.__super__.constructor.apply(this, arguments);
    }

    logs__log.prototype.createDom = function() {
      this.dom = $("<textarea class=\"control textbox log\">\n</textarea>");
      if (this.properties.path) {
        this.socket = ajentiConnectSocket('/log');
        this.socket.send(JSON.stringify({
          type: 'select',
          path: this.properties.path
        }));
        return this.socket.on('add', this.add);
      }
    };

    logs__log.prototype.add = function(data) {
      $(this.dom).val($(this.dom).val() + data);
      return this.dom.scrollTop = this.dom.scrollHeight;
    };

    logs__log.prototype.onBroadcast = function(msg) {
      if (msg === 'destruct') {
        if (this.socket) {
          return this.socket.disconnect();
        }
      }
    };

    return logs__log;

  })(window.Control);

}).call(this);
