Skip to content

Commit

Permalink
remove emit1(), use emit() instead, phetsims/axon#211
Browse files Browse the repository at this point in the history
  • Loading branch information
zepumph committed Feb 27, 2019
1 parent 06d1550 commit b7a7db0
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions js/demo/sim-like-components/model/Ball.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,25 +34,25 @@ define( function( require ) {
this.velocityProperty = new Property( initialVelocity );

// @public (read-only) {Emitter} - emitter that fires when the ball bounces, indicates surface on which it bounced
this.bounceEmitter = new Emitter();
this.bounceEmitter = new Emitter( { validationEnabled: false } );

// monitor the velocity Property and fire the emitter when a bounce occurs
this.velocityProperty.lazyLink( ( newVelocity, oldVelocity ) => {

// check for wall bounce
if ( oldVelocity.x > 0 && newVelocity.x < 0 ) {
this.bounceEmitter.emit1( 'right-wall' );
this.bounceEmitter.emit( 'right-wall' );
}
else if ( oldVelocity.x < 0 && newVelocity.x > 0 ) {
this.bounceEmitter.emit1( 'left-wall' );
this.bounceEmitter.emit( 'left-wall' );
}

// check for floor and ceiling bounce
if ( oldVelocity.y > 0 && newVelocity.y < 0 ) {
this.bounceEmitter.emit1( 'ceiling' );
this.bounceEmitter.emit( 'ceiling' );
}
else if ( oldVelocity.y < 0 && newVelocity.y > 0 ) {
this.bounceEmitter.emit1( 'floor' );
this.bounceEmitter.emit( 'floor' );
}
} );
}
Expand Down

0 comments on commit b7a7db0

Please sign in to comment.