On Jan 21, 2008 10:06 PM, Nicolás Sanguinetti <[EMAIL PROTECTED]> wrote: > On Jan 21, 2008 9:27 PM, Justin Perkins <[EMAIL PROTECTED]> wrote: > > 1) Delayed start of the Ajax requests > > 2) Max frequency, when using decay > > > > I use Ajax.PeriodicalUpdater a lot, but two things that I've never liked is > > the immediate start of the Ajax request and the infinite growth of the > > frequency that the decay option introduces. > > > > I noticed that the infinite growth problem was tackled with a patch quite a > > while ago, but it never made it into the final release for one reason or > > another (maybe because it turned into a debate about variable names). Here > > is the ticket: http://dev.rubyonrails.org/ticket/8184 > > > > Here is are two small wrap methods I use to enhance the current version of > > Prototype's Ajax.PeriodicalUpdater (1.6.0.1): > > http://pastie.textmate.org/141709 > > > > The code that precedes the call to updateComplete() is admittedly > > convoluted, but it was the best I could do without overwriting the entire > > method. > > What about > > if (this.options.decay) this.decay = > Math.max(this.options.maxFrequency || -Infinity, > this.options.maxFrequency / this.frequency / this.options.decay);
DOH, just realized you still need to check for this.o.maxFreq in the 'if', so no Infinity :( But still using Math.max seems like a good solution to the rest of your if. (Math.max makes me think of nerdy post-apocalyptic movies) -Nicolas > Gotta love Infinity :) > (haven't tested it, but my mind tells me it should work) > > > You may have seen my previous thread asking about using delay() in > > conjunction with apply(), which I want to use in the wrapped start() method. > > Since Ajax.PeriodicalUpdater#start () accepts no arguments, it's not really > > needed, but I'm still curious about that one. > > > > Is this list a good medium to discuss this sort of thing or should I just be > > submitting tested patches and hoping they find there way into a future > > release? > > I would discuss these sort of things in prototype-core > > Best, > -Nicolas > > > > -justin > > > > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
