// Copyright 2015-2020, University of Colorado Boulder

/**
 * A round momentary button: on when pressed, off when released.
 * This is the file in which the view (appearance) and model (behavior) are brought together.
 *
 * @author Chris Malley (PixelZoom, Inc.)
 */

import inherit from '../../../phet-core/js/inherit.js';
import merge from '../../../phet-core/js/merge.js';
import Tandem from '../../../tandem/js/Tandem.js';
import sun from '../sun.js';
import MomentaryButtonInteractionStateProperty from './MomentaryButtonInteractionStateProperty.js';
import MomentaryButtonModel from './MomentaryButtonModel.js';
import RoundButtonView from './RoundButtonView.js';
import RoundMomentaryButtonIO from './RoundMomentaryButtonIO.js';

/**
 * @param {Object} valueOff - value when the button is in the off state
 * @param {Object} valueOn - value when the button is in the on state
 * @param {Property} property
 * @param {Object} [options]
 * @constructor
 */
function RoundMomentaryButton( valueOff, valueOn, property, options ) {
  options = merge( {
    tandem: Tandem.REQUIRED,
    phetioType: RoundMomentaryButtonIO
  }, options );

  // @public Note it shares a tandem with this, so the emitter will be instrumented as a child of the button
  this.buttonModel = new MomentaryButtonModel( valueOff, valueOn, property, options );

  RoundButtonView.call( this, this.buttonModel, new MomentaryButtonInteractionStateProperty( this.buttonModel ), options );
}

sun.register( 'RoundMomentaryButton', RoundMomentaryButton );

inherit( RoundButtonView, RoundMomentaryButton, {

  // @public
  dispose: function() {
    this.buttonModel.dispose(); //TODO fails with assertions enable, see sun#212
    RoundButtonView.prototype.dispose.call( this );
  }
} );

export default RoundMomentaryButton;
@@ -266,64 +266,8 @@
 */%0A%0A
-import inherit from '../../../phet-core/js/inherit.js';%0A
 impo
@@ -675,20 +675,78 @@
 O.js';%0A%0A
+class RoundMomentaryButton extends RoundButtonView %7B%0A%0A  
 /**%0A
+  
  * @para
@@ -805,24 +805,26 @@
 e off state%0A
+  
  * @param %7BO
@@ -881,16 +881,18 @@
 n state%0A
+  
  * @para
@@ -913,16 +913,18 @@
 roperty%0A
+  
  * @para
@@ -949,56 +949,26 @@
 s%5D%0A 
-* @constructor%0A */%0Afunction RoundMomentaryButton
+  */%0A  constructor
 ( va
@@ -1006,16 +1006,19 @@
 ons ) %7B%0A
+%0A  
   option
@@ -1034,16 +1034,18 @@
 ( %7B%0A    
+  
 tandem: 
@@ -1061,16 +1061,18 @@
 QUIRED,%0A
+  
     phet
@@ -1104,16 +1104,18 @@
 tonIO%0A  
+  
 %7D, optio
@@ -1121,28 +1121,22 @@
 ons );%0A%0A
+  
   //
- @public
  Note it
@@ -1226,21 +1226,24 @@
 utton%0A  
-this.
+  const 
 buttonMo
@@ -1321,41 +1321,17 @@
 %0A%0A  
-RoundButtonView.call( this, this.
+  super( 
 butt
@@ -1384,21 +1384,16 @@
 operty( 
-this.
 buttonMo
@@ -1414,157 +1414,114 @@
  );%0A
-%7D%0A%0Asun.register( 'RoundMomentaryButton', RoundMomentaryButton );%0A%0Ainherit( RoundButtonView, RoundMomentaryButton, %7B%0A%0A  // @public%0A  dispose: function
+%0A    // @public%0A    this.buttonModel = buttonModel;%0A  %7D%0A%0A  /**%0A   * @public%0A   * @override%0A   */%0A  dispose
 () %7B
@@ -1610,66 +1610,94 @@
     
-RoundButtonView.prototype.dispose.call( this );%0A  %7D%0A%7D
+super.dispose();%0A  %7D%0A%7D%0A%0Asun.register( 'RoundMomentaryButton', RoundMomentaryButton
  );%0A
-%0A
 expo

convert RoundMomentaryButton to ES6 class, https://github.com/phetsims/tasks/issues/1044