RyanMullins / angular-hammer

Hammer.js v2 support for AngularJS
http://ryanmullins.github.io/angular-hammer/
MIT License
188 stars 55 forks source link

Should probably call hammer.destroy on scope $destroy event #10

Closed makkeu closed 9 years ago

makkeu commented 9 years ago

I was chasing a memory leak and looks like it was caused by this module. I tried to replace code in $destroy event from:

              scope.$on('$destroy', function () {
                hammer.off(eventName, handler);
              });

to this:

            scope.$on('$destroy', function () {
              hammer.destroy();
            });

This change seems to fix my memory leaks.