You could also put the following into a file you include after
prototype.js:


Object.extend(Form.Observer.prototype, {
  registerCallback: function() {
    this.intervalId = setInterval(this.onTimerEvent.bind(this),
this.frequency * 1000);
  },

  stop: function() {
    if (this.intervalId) clearInterval(this.intervalId);
  }
}


then you would be able to call fo.stop()


-Tobias


On 12 Mar., 16:55, "bucktus" <[EMAIL PROTECTED]> wrote:
> Cheers.
> thanks.
>
> On Mar 12, 10:41 am, Christophe Porteneuve <[EMAIL PROTECTED]> wrote:
>
> > Hey,
>
> > Since there currently is no cancel/stop facility in Form.Observer, your
> > only shot is to use some variable accessible by your callback, that
> > toggles it off after the first shot, e.g.
>
> > var formChanged = function() {
> >   if (arguments.callee.notAnymore) return;
> >   // ...
> >   arguments.callee.notAnymore = true;}
>
> > formChanged.prototype.notAnymore = false;
>
> > new Form.Observer('formId', 2, formChanged);
>
> > (yes, function prototypes can be used to store "function-static"
> > variables...  You'll see this trick here and there in Prototype's source
> > code).
>
> > --
> > Christophe Porteneuve a.k.a. TDD
> > "[They] did not know it was impossible, so they did it." --Mark Twain
> > Email: [EMAIL PROTECTED]


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to