pixijs / particle-emitter

A particle system for PixiJS
http://pixijs.io/particle-emitter/docs
MIT License
799 stars 127 forks source link

Use new Function() instead of eval() #69

Closed TimMensch closed 6 years ago

TimMensch commented 6 years ago

When using pixi-particles with Rollup.js, it will throw an error if you use eval() directly. See https://github.com/rollup/rollup/wiki/Troubleshooting#avoiding-eval

This should be effectively identical to the eval call, except for the possibility of eval grabbing or writing to local variables (a trait that the original code actually relied on). This also feels marginally cleaner, though it's only fractionally more secure.

Tested to verify that it still works as expected.

andrewstart commented 6 years ago

Thanks, I had been thinking about going back to do this (didn't know you could make functions this way when I first wrote it).