[Prototype-core] Re: Any intention of providing a function.throttle?

2010-04-27 Thread "Cowboy" Ben Alman
Re. disabling the trailing execution during throttle: you might want a function to execute every N milliseconds only while you're performing an action. Perhaps it doesn't update a state value, but simple shows a progress bar while the action is taking place. In this case, it would be detrimental to

Re: [Prototype-core] Re: Any intention of providing a function.throttle?

2010-04-27 Thread Mislav Marohnić
On Tue, Apr 27, 2010 at 16:09, "Cowboy" Ben Alman wrote: > > That being said, this throttle (and yours) don't have an option for > disabling that final "deferred" execution. What is the use case for disabling this final call? Or for forcing the intial call right at the start? I've noticed you h

[Prototype-core] Re: Any intention of providing a function.throttle?

2010-04-27 Thread "Cowboy" Ben Alman
Mislav, this will minify slightly smaller (152b) than what you have (156b): Function.prototype.throttle = function( delay ) { var fn = this, timeout_id; return function(){ var that = this, args = arguments; if ( !timeout_id ) { timeout_id =

Re: [Prototype-core] Re: Any intention of providing a function.throttle?

2010-04-27 Thread Mislav Marohnić
On Sun, Apr 25, 2010 at 23:08, "Cowboy" Ben Alman wrote: > I've got a snippet of code that will allow you to either throttle or > debounce a function, in multiple ways. Yes, this was among the existing plugins I saw. I also read the source, but I felt it was a bit too much for this functionalit

[Prototype-core] Re: Any intention of providing a function.throttle?

2010-04-26 Thread "Cowboy" Ben Alman
I tried posting this the other day, but my post didn't come through for some reason. I've got a snippet of code that will allow you to either throttle or debounce a function, in multiple ways. Granted, my implementation does not use the Function prototype, but that would be trivial to implement. (