lib/gcli/languages/command.js
function(ev) {
    if (ev.output.hidden) {
      return;
    }

    var template = this.commandDom.cloneNode(true);
    var templateOptions = { stack: 'terminal.html#outputView' };

    var context = this.requisition.conversionContext;
    var data = {
      onclick: context.update,
      ondblclick: context.updateExec,
      language: this,
      output: ev.output,
      promptClass: (ev.output.error ? 'gcli-row-error' : '') +
                   (ev.output.completed ? ' gcli-row-complete' : ''),
      // Elements attached to this by template().
      rowinEle: null,
      rowoutEle: null,
      throbEle: null,
      promptEle: null
    };

    domtemplate.template(template, data, templateOptions);

    ev.output.promise.then(function() {
      var document = data.rowoutEle.ownerDocument;

      if (ev.output.completed) {
        data.promptEle.classList.add('gcli-row-complete');
      }
      if (ev.output.error) {
        data.promptEle.classList.add('gcli-row-error');
      }

      util.clearElement(data.rowoutEle);

      return ev.output.convert('dom', context).then(function(node) {
        this.terminal.scrollToBottom();
        data.throbEle.style.display = ev.output.completed ? 'none' : 'block';

        if (node == null) {
          data.promptEle.classList.add('gcli-row-error');
          // TODO: show some error to the user
        }

        this._linksToNewTab(node);
        data.rowoutEle.appendChild(node);

        var event = document.createEvent('Event');
        event.initEvent('load', true, true);
        event.addedElement = node;
        node.dispatchEvent(event);
      }.bind(this));
    }.bind(this)).catch(console.error);

    this.terminal.addElement(data.rowinEle);
    this.terminal.addElement(data.rowoutEle);
    this.terminal.scrollToBottom();

    this.focusManager.outputted();
  }
function(ev) {
    if (ev.output.hidden) {
      return;
    }

    var template = this.commandDom.cloneNode(true);
    var templateOptions = { stack: 'terminal.html#outputView' };

    var context = this.requisition.conversionContext;
    var data = {
      onclick: context.update,
      ondblclick: context.updateExec,
      language: this,
      output: ev.output,
      promptClass: (ev.output.error ? 'gcli-row-error' : '') +
                   (ev.output.completed ? ' gcli-row-complete' : ''),
      // Elements attached to this by template().
      rowinEle: null,
      rowoutEle: null,
      throbEle: null,
      promptEle: null
    };

    domtemplate.template(template, data, templateOptions);

    ev.output.promise.then(function() {
      var document = data.rowoutEle.ownerDocument;

      if (ev.output.completed) {
        data.promptEle.classList.add('gcli-row-complete');
      }
      if (ev.output.error) {
        data.promptEle.classList.add('gcli-row-error');
      }

      util.clearElement(data.rowoutEle);

      return ev.output.convert('dom', context).then(function(node) {
        this.terminal.scrollToBottom();
        data.throbEle.style.display = ev.output.completed ? 'none' : 'block';

        if (node == null) {
          data.promptEle.classList.add('gcli-row-error');
          // TODO: show some error to the user
        }

        this._linksToNewTab(node);
        data.rowoutEle.appendChild(node);

        var event = document.createEvent('Event');
        event.initEvent('load', true, true);
        event.addedElement = node;
        node.dispatchEvent(event);
      }.bind(this));
    }.bind(this)).catch(console.error);

    this.terminal.addElement(data.rowinEle);
    this.terminal.addElement(data.rowoutEle);
    this.terminal.scrollToBottom();

    this.focusManager.outputted();
  }
function ( ev ) { if ( ev . output . hidden ) { return ; } var template = this . commandDom . cloneNode ( true ) ; var templateOptions = { stack : 'terminal.html#outputView' } ; var context = this . requisition . conversionContext ; var data = { onclick : context . update , ondblclick : context . updateExec , language : this , output : ev . output , promptClass : ( ev . output . error ? 'gcli-row-error' : '' ) + ( ev . output . completed ? ' gcli-row-complete' : '' ) , // Elements attached to this by template(). rowinEle : null , rowoutEle : null , throbEle : null , promptEle : null } ; domtemplate . template ( template , data , templateOptions ) ; ev . output . promise . then ( function ( ) { var document = data . rowoutEle . ownerDocument ; if ( ev . output . completed ) { data . promptEle . classList . add ( 'gcli-row-complete' ) ; } if ( ev . output . error ) { data . promptEle . classList . add ( 'gcli-row-error' ) ; } util . clearElement ( data . rowoutEle ) ; return ev . output . convert ( 'dom' , context ) . then ( function ( node ) { this . terminal . scrollToBottom ( ) ; data . throbEle . style . display = ev . output . completed ? 'none' : 'block' ; if ( node == null ) { data . promptEle . classList . add ( 'gcli-row-error' ) ; // TODO: show some error to the user } this . _linksToNewTab ( node ) ; data . rowoutEle . appendChild ( node ) ; var event = document . createEvent ( 'Event' ) ; event . initEvent ( 'load' , true , true ) ; event . addedElement = node ; node . dispatchEvent ( event ) ; } . bind ( this ) ) ; } . bind ( this ) ) . catch ( console . error ) ; this . terminal . addElement ( data . rowinEle ) ; this . terminal . addElement ( data . rowoutEle ) ; this . terminal . scrollToBottom ( ) ; this . focusManager . outputted ( ) ; }
Monitor for new command executions
Monitor for new command executions