components/blockly-src/blocks/logic.js
function(e) {
    var blockA = this.getInputTargetBlock('THEN');
    var blockB = this.getInputTargetBlock('ELSE');
    var parentConnection = this.outputConnection.targetConnection;
    // Disconnect blocks that existed prior to this change if they don't match.
    if ((blockA || blockB) && parentConnection) {
      for (var i = 0; i < 2; i++) {
        var block = (i == 1) ? blockA : blockB;
        if (block && !block.outputConnection.checkType_(parentConnection)) {
          // Ensure that any disconnections are grouped with the causing event.
          Blockly.Events.setGroup(e.group);
          if (parentConnection === this.prevParentConnection_) {
            this.unplug();
            parentConnection.getSourceBlock().bumpNeighbours_();
          } else {
            block.unplug();
            block.bumpNeighbours_();
          }
          Blockly.Events.setGroup(false);
        }
      }
    }
    this.prevParentConnection_ = parentConnection;
  }
function(e) {
    var blockA = this.getInputTargetBlock('THEN');
    var blockB = this.getInputTargetBlock('ELSE');
    var parentConnection = this.outputConnection.targetConnection;
    // Disconnect blocks that existed prior to this change if they don't match.
    if ((blockA || blockB) && parentConnection) {
      for (var i = 0; i < 2; i++) {
        var block = (i == 1) ? blockA : blockB;
        if (block && !block.outputConnection.checkType_(parentConnection)) {
          // Ensure that any disconnections are grouped with the causing event.
          Blockly.Events.setGroup(e.group);
          if (parentConnection === this.prevParentConnection_) {
            this.unplug();
            parentConnection.getSourceBlock().bumpNeighbours_();
          } else {
            block.unplug();
            block.bumpNeighbours_();
          }
          Blockly.Events.setGroup(false);
        }
      }
    }
    this.prevParentConnection_ = parentConnection;
  }
function ( e ) { var blockA = this . getInputTargetBlock ( 'THEN' ) ; var blockB = this . getInputTargetBlock ( 'ELSE' ) ; var parentConnection = this . outputConnection . targetConnection ; // Disconnect blocks that existed prior to this change if they don't match. if ( ( blockA || blockB ) && parentConnection ) { for ( var i = 0 ; i < 2 ; i ++ ) { var block = ( i == 1 ) ? blockA : blockB ; if ( block && ! block . outputConnection . checkType_ ( parentConnection ) ) { // Ensure that any disconnections are grouped with the causing event. Blockly . Events . setGroup ( e . group ) ; if ( parentConnection === this . prevParentConnection_ ) { this . unplug ( ) ; parentConnection . getSourceBlock ( ) . bumpNeighbours_ ( ) ; } else { block . unplug ( ) ; block . bumpNeighbours_ ( ) ; } Blockly . Events . setGroup ( false ) ; } } } this . prevParentConnection_ = parentConnection ; }
Called whenever anything on the workspace changes.
Prevent mismatched types.
@param {!Blockly.Events.Abstract} e Change event.
@this Blockly.Block
Called whenever anything on the workspace changes . Prevent mismatched types .