I have the following code, which when called repeatedly is throwing this error - RangeError: Maximum call stack size exceeded
var timeout = window.setTimeout(function() {
onAnimationEnd(null);
}, 2000)
onAnimationEnd : function(e) {
if (e != null)
e.stopPropogation();
animatedObject.removeClass(this.triggerClass);
animatedObject.unbind(this.endEventName);
window.clearTimeout(this.timeout);
}
What are the possible scenarios in which this error can pop up other than calling the function directly?
this.timeout
won't work, you have the variable timeout
in another scope, you should probably pass it as a paramter also:
var timeout = window.setTimeout(function() {
onAnimationEnd(null, timeout);
}, 2000);
onAnimationEnd(e, timeout) {
if (e != null)
e.stopPropogation();
animatedObject.removeClass(this.triggerClass);
animatedObject.unbind(this.endEventName);
window.clearTimeout(timeout);
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.