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 = setTimeout(function(){ fn.apply( that, args ); timeout_id = null; }, delay); } }; }; That being said, this throttle (and yours) don't have an option for disabling that final "deferred" execution. I have made a "prototype" version of my jQuery plugin here, it has all the same functionality of the jQuery version, but is called in a prototype-style way: http://gist.github.com/380755 - Ben On Apr 27, 5:52 am, Mislav Marohnić <mislav.maroh...@gmail.com> wrote: > On Sun, Apr 25, 2010 at 23:08, "Cowboy" Ben Alman <cow...@rj3.net> 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 functionality. Since you've written > this plugin, can you take a look at my code (last 2 snippets on this thread) > and tell me if there's anything I might have overlooked in my > implementations? > > -- > You received this message because you are subscribed to the Google Groups > "Prototype: Core" group. > To post to this group, send email to prototype-core@googlegroups.com > To unsubscribe from this group, send email to > prototype-core-unsubscr...@googlegroups.com > For more options, visit this group > athttp://groups.google.com/group/prototype-core?hl=en -- You received this message because you are subscribed to the Google Groups "Prototype: Core" group. To post to this group, send email to prototype-core@googlegroups.com To unsubscribe from this group, send email to prototype-core-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en