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

2010-04-23 Thread Mislav Marohnić
I wanted to propose Function#throttle for core, only to find out it was suggested here on the list exactly a year ago: On Tue, Apr 21, 2009 at 22:01, Ignacio Coloma icol...@gmail.com wrote: Hi, the idea was showcased some time ago in ajaxian:

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

2010-04-23 Thread Mislav Marohnić
On Fri, Apr 23, 2010 at 12:28, Mislav Marohnić mislav.maroh...@gmail.comwrote: Here is my implementation: I noticed there might be a bug with preserving scope in my original implementation. Here is the revised version: Function.prototype.throttle = function(t) { var timeout, fn = this

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

2010-04-23 Thread Nacho Coloma
That's a step better than my own implementation. So, will it get into core? On Fri, Apr 23, 2010 at 12:43 PM, Mislav Marohnić mislav.maroh...@gmail.com wrote: On Fri, Apr 23, 2010 at 12:28, Mislav Marohnić mislav.maroh...@gmail.comwrote: Here is my implementation: I noticed there might

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

2010-04-23 Thread Mislav Marohnić
2010/4/23 Nacho Coloma icol...@gmail.com That's a step better than my own implementation. Thanks, guys. But honestly, it's not something that hasn't be done before. I'm just proposing formalizing it. About core, that's up to Tobie and Andrew. But what do you guys think about naming? And how

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

2010-04-23 Thread jim
Thanks, guys. But honestly, it's not something that hasn't be done before. I'm just proposing formalizing it. About core, that's up to Tobie and Andrew. But what do you guys think about naming? And how would you implement a real throttling function; one that lets a call through at

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

2010-04-23 Thread Titi Alailima
On Fri, Apr 23, 2010 at 6:28 AM, Mislav Marohnić mislav.maroh...@gmail.comwrote: I use it primarily for keyup events (where this is absolutely essential), but it has other uses. The feedback I wanted to get here is naming. The jQuery community calls this function debounce, because throttling

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

2010-04-23 Thread Allen Madsen
I have used something like this in a project as well. I wouldn't mind seeing it in core. I don't particularly care what its called. Allen Madsen http://www.allenmadsen.com On Fri, Apr 23, 2010 at 9:00 AM, Titi Alailima tigreti...@gmail.com wrote: On Fri, Apr 23, 2010 at 6:28 AM, Mislav

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

2010-04-23 Thread Mislav Marohnić
On Fri, Apr 23, 2010 at 15:00, Titi Alailima tigreti...@gmail.com wrote: debounce is a technical term, and it refers to the very case that you are trying to handle. Thanks, Titi, for the insightful explanation. Here is how I would implement a real throttle method:

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

2010-04-23 Thread Andrew Dupont
I like this. I don't particularly care what we call it. Too late for 1.7, naturally, but perhaps 1.7.1 or 1.8... Cheers, Andrew On Apr 23, 2010, at 10:15 AM, Mislav Marohnić wrote: On Fri, Apr 23, 2010 at 15:00, Titi Alailima tigreti...@gmail.com wrote: debounce is a technical term, and it