briangonzalez / jquery.pep.js

👟 Pep, a lightweight plugin for kinetic drag on mobile/desktop
http://pep.briangonzalez.org
1.3k stars 177 forks source link

$.pep.peps list not updated after unbinding? #153

Closed protozoo closed 7 years ago

protozoo commented 9 years ago

Hi,

I just noticed the $.pep.peps array keeps growing and growing in my app (I use pep in one of my views, which gets instantiated multiple times throughout the application life span). Is this normal? I'm using the unbind() method as suggested in the documentation:

var $pep = $('.pep'); $pep.pep(); // bind $.pep.unbind( $pep ); // unbind

I gave a quick look at the code and didn't find that the array gets spliced, unshifted or otherwise altered besides the push() call when calling pep(), so it looks like this ever-growing list is by design. Is it so?

Many thanks!

marcoancona commented 8 years ago

Agree... Since I need to frequently update the contraints, I unbind my DOM element and recreate the Pep object. This will make the peps list growing indefinitely.