phetsims/neuron

Use `this` where appropriate

Closed this issue · 1 comments

In some contexts, the closure variable self is used instead of this, which is somewhat confusing.

  function DelayBuffer( maxDelay, minTimeStep ) {
    var self = this;
    self.numEntries = Math.ceil( maxDelay / minTimeStep ); // @private
    self.filling = false; // @private
    self.allDeltaTimesEqual = true; // @private
    self.previousDeltaTime = -1; // @private
    self.countAtThisDeltaTime = 0; // @private
    // Allocate the memory that will be used.
    self.delayElements = new Array( this.numEntries ); // @private

Done, closing. This touched a lot of files - I think the original author of the port had the philosophy of setting up a self var at the top of the file and using it everywhere. I'll make sure I put a note in the development guidelines that this is not our standard.