stanlemon/jGrowl

clearInterval during shutdown?

Closed this issue · 1 comments

I have some code that erases a registration dialog upon submission and replaces it with a simple message. Part of the form that gets erased includes the element that a jGrowl message is attached to. When the form is switched and the message div is removed and I get the follwing error on the console:

"Uncaught TypeError: Cannot call method 'update' of undefined"

which points to jquery.jgrowl.js:334

this.interval = setInterval( function() {
L:334 $(e).data('jGrowl.instance').update();
"Uncaught TypeError: Cannot call method 'update' of undefined"
}, parseInt(this.defaults.check));

It appears that the setInterval is left hanging somehow?

I tried calling jGrowl('shutdown') just before removing the DOM elements and this does not fix the problem.

But, if I add the following to the end of the jGrowl shutdown method:

clearInterval(this.interval);

The error goes away.

So, I can certainly modify my local copy of jGrowl, but I am wondering if this points to a possible bugfix? Is the jGrowl setInterval call being properly terminated during the shutdown call?

Thanks!

This is definitely a bug. I think my latest change should resolve it though.