Markus Hammer
2007-Oct-15 15:42 UTC
proposal for an extension to Ajax.PeriodicalUpdater stop();
Hi, lately i used Ajax.PeriodicalUpdater in a project to keep fetching an pageable ajax object from my backend and i ran into a small problem. whenever the user pressed the button to page through the list i have to stop the periodicalupdater to not overwrite my divbox, which was rather trivial, however - once the user paged back to the first page the updater should be started again. now my solution was - put a javascript into the html if its the first page and kickstart the updater from there but that lead to a infinite loop, so i had to supply the updater object with a boolean stopped property whenever i started and stopped it, that would then be checked by the embeded javascript in the html of the ajax response. how about the periodical updater class setting this stopped property itself which would make it easier to check if the updater is running or not? something like this: @ Line 1122 in prototype.js start: function() { this.options.onComplete = this.updateComplete.bind(this); this.stopped = false; this.onTimerEvent(); }, stop: function() { this.updater.options.onComplete = undefined; clearTimeout(this.timer); this.stopped = true; (this.onComplete || Prototype.emptyFunction).apply(this, arguments); }, --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---