phetsims / color-vision

"Color Vision" is an educational simulation in HTML5, by PhET Interactive Simulations.
http://phet.colorado.edu/en/simulation/color-vision
GNU General Public License v3.0
1 stars 7 forks source link

Use Poolable for pooling #10

Closed samreid closed 10 years ago

samreid commented 10 years ago

I noticed that PhotonBeam is using its own pooling implementation. Would it be possible to rewrite the pooling using PHET_CORE/Poolable so that this logic can be isolated/consolidated? One issue that may come up in the near future is different handling of free/used items, since array push/pop creates garbage itself. If we are all using one implementation of pooling, it could be easier to address issues like that. For an example of how to use Poolable, see DOT/Vector2.

aaronsamuel137 commented 10 years ago

Stay tuned, I still need to fix a few errors. I'll commit again for this issue.

aaronsamuel137 commented 10 years ago

I think I've got it now. There is still a JSHint warning about using Poolable constructor without the "new" keyword, but I have left it for now since that is the usage in Vector2 as well.

Assigning to @samreid for review

samreid commented 10 years ago

I added /* jshint -W064 */ to work around Poolable linting issue.

samreid commented 10 years ago

Looks like it is working well, nice work. Closing.