<commit_before>// Copyright 2013-2020, University of Colorado Boulder

/**
 * This toggle button uses a boolean property and a trueNode and falseNode to display its content.
 */

import inherit from '../../../phet-core/js/inherit.js';
import merge from '../../../phet-core/js/merge.js';
import Tandem from '../../../tandem/js/Tandem.js';
import BooleanToggleNode from '../BooleanToggleNode.js';
import sun from '../sun.js';
import RoundToggleButton from './RoundToggleButton.js';

/**
 * @param {Node} trueNode
 * @param {Node} falseNode
 * @param {Property.<boolean>} booleanProperty
 * @param {Object} [options]
 * @constructor
 */
function BooleanRoundToggleButton( trueNode, falseNode, booleanProperty, options ) {

  options = merge( {
    tandem: Tandem.REQUIRED
  }, options );

  assert && assert( !options.content, 'BooleanRoundToggleButton sets content' );
  options.content = new BooleanToggleNode( trueNode, falseNode, booleanProperty, {
    tandem: options.tandem.createTandem( 'toggleNode' )
  } );

  RoundToggleButton.call( this, false, true, booleanProperty, options );

  // @private
  this.disposeBooleanRoundToggleButton = function() {
    options.content.dispose();
  };
}

sun.register( 'BooleanRoundToggleButton', BooleanRoundToggleButton );

inherit( RoundToggleButton, BooleanRoundToggleButton, {

  /**
   * @public
   * @override
   */
  dispose: function() {
    this.disposeBooleanRoundToggleButton();
    RoundToggleButton.prototype.dispose.call( this );
  }
} );

export default BooleanRoundToggleButton;<commit_msg>convert BooleanRoundToggleButton and subclasses to ES6 class, https://github.com/phetsims/tasks/issues/1044<commit_after>// Copyright 2013-2020, University of Colorado Boulder

/**
 * This toggle button uses a boolean property and a trueNode and falseNode to display its content.
 */

import merge from '../../../phet-core/js/merge.js';
import Tandem from '../../../tandem/js/Tandem.js';
import BooleanToggleNode from '../BooleanToggleNode.js';
import sun from '../sun.js';
import RoundToggleButton from './RoundToggleButton.js';

class BooleanRoundToggleButton extends RoundToggleButton {

  /**
   * @param {Node} trueNode
   * @param {Node} falseNode
   * @param {Property.<boolean>} booleanProperty
   * @param {Object} [options]
   */
  constructor( trueNode, falseNode, booleanProperty, options ) {

    options = merge( {
      tandem: Tandem.REQUIRED
    }, options );

    assert && assert( !options.content, 'BooleanRoundToggleButton sets content' );
    options.content = new BooleanToggleNode( trueNode, falseNode, booleanProperty, {
      tandem: options.tandem.createTandem( 'toggleNode' )
    } );

    super( false, true, booleanProperty, options );

    // @private
    this.disposeBooleanRoundToggleButton = function() {
      options.content.dispose();
    };
  }

  /**
   * @public
   * @override
   */
  dispose() {
    this.disposeBooleanRoundToggleButton();
    super.dispose();
  }
}

sun.register( 'BooleanRoundToggleButton', BooleanRoundToggleButton );
export default BooleanRoundToggleButton;
{'fraction_non_alphanumeric': 0.13335507010107597, 'fraction_numerical': 0.006847081838930551, 'mean_word_length': 3.9166666666666665, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5986321', 'n_tokens_mistral': 901, 'n_tokens_neox': 864, 'n_words': 222}