Closed dontboyle closed 8 years ago
you have to tell it which callback you want to remove, it doesn't clear them all out like jquery does.
You can monitor.destory()
if you want to destroy it.
So I have to pass in the onEnterFunction to the .off??
Got it thanks!
@stutrek
Hey I appreciate the feedback so far - just wanted to let you know that the above is still not working properly. - Off does so I'm good to go, thought i'd leave this here however.
var monitor = scrollMonitor.create(someElement);
monitor.on('enterViewport', onEnter); //works
//monitor.off('enterViewport', onEnter); //works
monitor.destroy(); //doesn't work
var monitor = scrollMonitor.create(someElement); .on('enterViewport', onEnterFunction); //works great
.off('enterViewport') //doesn't work //keeps calling .on('enterViewport', onEnter);
Same with destroy - doesn't work.
Thanks for any feedback