The destroy method resolves an issue I found when using Impetus to create a pseudo scrollable zone for a touch app. In my script the settings of Impetus need to update if content size changes, so it reinstantiates with new bound settings on the same source element.
However this resulted in multiple touchstart and mousedown events (for each time an instance was called) because onDown is an entirely new function for each instance, resulting in crazyness.
I realize that 90% of the time Impetus isn't used for scrolling and generally an instance would only be created once on a target element, however this small change allows a developer to remove the touchstart and mousedown if required at some point such as my use case.
The destroy method resolves an issue I found when using Impetus to create a pseudo scrollable zone for a touch app. In my script the settings of Impetus need to update if content size changes, so it reinstantiates with new bound settings on the same source element.
However this resulted in multiple
touchstart
andmousedown
events (for each time an instance was called) becauseonDown
is an entirely new function for each instance, resulting in crazyness.I realize that 90% of the time Impetus isn't used for scrolling and generally an instance would only be created once on a target element, however this small change allows a developer to remove the
touchstart
andmousedown
if required at some point such as my use case.