Re: Calling class method from PeriodicalExecuter

Antonio CS
Fri, 30 Nov 2007 23:25:41 -0000

Thanks! It worked great!

On Nov 30, 2007 4:25 PM, Woodham, Thomas
<twoodham-lm4C025e6zTdToeN5bPUx9BPR1lH4CV8@public.gmane.org>
wrote:

>  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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org] *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 :)
> >
>