Re: Calling class method from PeriodicalExecuter

Woodham, Thomas
Fri, 30 Nov 2007 16:25:33 -0000

I''m attempting to do the same thing.  This appears to work:

    new PeriodicalExecuter (this.processSwap.bind (this), this.transtime);


Thomas Woodham
Data Editor - The Greenville News
864.298.4302

[BECAUSE THE NEWS NEVER STOPS]



________________________________
From: rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
[mailto:rubyonrails-spinoffs@googlegroups.com] On Behalf Of Antonio CS
Sent: Friday, November 30, 2007 10:51 AM
To: rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
Subject: [Rails-spinoffs] Calling class method from PeriodicalExecuter

Hey!

I have created a class and in the initialize function I created a
PeriodicalExecuter which must call a class method every 5 seconds.
But how do I reference the class or the class member? I can''t use this
can I???
I have this

new PeriodicalExecuter(function(pe) {
                this.processSwap();
              }, this.transtime);


And I was writing this I thought it wouldn''t work because the this in
the function will refer to the function itself right?

Can anyone help me out please?
Thanks :)