Skip to content

Commit

Permalink
Removed Charge.disposed, see #317
Browse files Browse the repository at this point in the history
  • Loading branch information
samreid committed Aug 23, 2017
1 parent 4a48735 commit 748681e
Showing 1 changed file with 0 additions and 9 deletions.
9 changes: 0 additions & 9 deletions js/model/Charge.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,6 @@ define( function( require ) {
// @public (read-only) {CircuitElement} - the CircuitElement the Charge is in, changed by Charge.setLocation
this.circuitElement = circuitElement;

// @private (read-only) {boolean} - whether the charge has been disposed, to aid in debugging
//REVIEW: If for debugging, can this be removed, or set only when assertions are enabled? Would help memory to remove, particularly since a lot
//REVIEW: of charges get created.
//REVIEW(samreid): This was once very useful, but now I think it can be removed.
this.deleted = false;

// @public (read-only) {NumberProperty} - the distance the charge has traveled in its CircuitElement in view
// coordinates
this.distanceProperty = new NumberProperty( distance );
Expand Down Expand Up @@ -78,7 +72,6 @@ define( function( require ) {
var multilink = Property.multilink( [ this.distanceProperty, this.updatingPositionProperty ],
function( distance, updating ) {
if ( updating ) {
assert && assert( !self.deleted, 'Charge was deleted' );
assert && assert( !isNaN( distance ), 'charge position was not a number' );
var positionAndAngle = self.circuitElement.getPositionAndAngle( distance );
var position = positionAndAngle.position;
Expand All @@ -101,9 +94,7 @@ define( function( require ) {
//REVIEW: We should not be creating copies of this function for objects that get created a lot, as it presumably
//REVIEW: increases the amount of memory used. This looks exactly like something that should be a method instead.
this.disposeCharge = function() {
assert && assert( !self.deleted, 'cannot delete twice' );
multilink.dispose();
self.deleted = true;
self.disposeEmitter.emit();
self.disposeEmitter.removeAllListeners();
};
Expand Down

0 comments on commit 748681e

Please sign in to comment.