Thanks. I should have done that in the first place.  I guess thats what
happens when you are coding at 3am ! J

 

Thanks again

 

From: Arian Stolwijk [mailto:[email protected]] 
Sent: Monday, 4 July 2011 3:09 AM
To: [email protected]
Subject: Re: [Moo] clearTimeout on a Class function

 

try this:

 

var fooBar = new Class({

    popit : function () {

        alert("hello")

        }

    })

fooInt = new fooBar()

var timer = fooInt.popit.delay(5000, fooInt);

clearTimeout(timer);

 

so basically make sure that the context (this) is correct in the method,
this can be passed as second argument in the delay method.

delay (and periodical / setTimeout / setInterval) returns a timeoutID that
you can use in the clearTimeout / clearInterval.

 

On Sun, Jul 3, 2011 at 6:04 PM, Steve Onnis <[email protected]> wrote:

Could someone tell me if this is a javascript thing or a mootools issue

 

When you create a new Class() and then try to call a method on the class
with function.delay() and then try to stop that delay the function still
runs.

 

For example

 

fooBar = new Class({

    popit : function () {

        alert("hello")

        }

    })

fooInt = new fooBar()

fooInt.popit.delay(5000);

clearTimeout(fooInt)

 

Even though the clearTimeout() is called for the delay the function still
runs.

 

Any ideas?

 

Steve

 

Reply via email to