Side navigation
#10417 closed feature (fixed)
Opened October 04, 2011 03:39PM UTC
Closed December 11, 2012 01:58AM UTC
Last modified January 15, 2013 02:13AM UTC
Remove second arg from setTimeout calls (WAS jQuery.later)
Reported by: | gnarf | Owned by: | gnarf |
---|---|---|---|
Priority: | low | Milestone: | 1.9 |
Component: | core | Version: | git |
Keywords: | 1.9-discuss | Cc: | |
Blocked by: | Blocking: |
Description
We are starting to use more and more
setTimeout( fn, 0 );calls around our code base. I think now that there is also a
setImmediateand there is also the postMessage that we should probably try to take advantage of these.
I would like to propose a
jQuery.later( fn )that wraps the "best" possible function here.
Attachments (0)
Change History (28)
Changed October 04, 2011 03:41PM UTC by comment:1
keywords: | → 1.8-discuss |
---|
Changed October 04, 2011 03:42PM UTC by comment:2
description: | We are starting to use more and more {{{ setTimeout( fn, 0 ); }}} calls around our code base. I think now that there is also a {{{ setImmediate }}} and there is also the postMessage. \ \ I would like to propose a {{{ jQuery.later( fn ) }}} that wraps the "best" possible function here. → We are starting to use more and more {{{ setTimeout( fn, 0 ); }}} calls around our code base. I think now that there is also a {{{ setImmediate }}} and there is also the postMessage that we should probably try to take advantage of these. \ \ I would like to propose a {{{ jQuery.later( fn ) }}} that wraps the "best" possible function here. |
---|
Changed October 04, 2011 03:47PM UTC by comment:3
neat!
Changed October 04, 2011 03:47PM UTC by comment:4
component: | unfiled → core |
---|
Changed October 07, 2011 12:32AM UTC by comment:5
priority: | undecided → low |
---|---|
status: | new → open |
Changed December 13, 2011 02:59PM UTC by comment:7
description: | We are starting to use more and more {{{ setTimeout( fn, 0 ); }}} calls around our code base. I think now that there is also a {{{ setImmediate }}} and there is also the postMessage that we should probably try to take advantage of these. \ \ I would like to propose a {{{ jQuery.later( fn ) }}} that wraps the "best" possible function here. → We are starting to use more and more {{{ setTimeout( fn, 0 ); }}} calls around our code base. I think now that there is also a {{{ setImmediate }}} and there is also the postMessage that we should probably try to take advantage of these.\ \ I would like to propose a {{{ jQuery.later( fn ) }}} that wraps the "best" possible function here. |
---|
-1, There is no reason why this needs to depend on jQuery apart from bundling it.
Changed December 13, 2011 04:17PM UTC by comment:8
+1, not only does it make sense, it should also save some size.
Changed December 13, 2011 06:20PM UTC by comment:9
description: | We are starting to use more and more {{{ setTimeout( fn, 0 ); }}} calls around our code base. I think now that there is also a {{{ setImmediate }}} and there is also the postMessage that we should probably try to take advantage of these.\ \ I would like to propose a {{{ jQuery.later( fn ) }}} that wraps the "best" possible function here. → We are starting to use more and more {{{ setTimeout( fn, 0 ); }}} calls around our code base. I think now that there is also a {{{ setImmediate }}} and there is also the postMessage that we should probably try to take advantage of these. \ \ I would like to propose a {{{ jQuery.later( fn ) }}} that wraps the "best" possible function here. |
---|
+1, It's small and we can use it internally, so yeah.
Changed December 14, 2011 01:25AM UTC by comment:10
description: | We are starting to use more and more {{{ setTimeout( fn, 0 ); }}} calls around our code base. I think now that there is also a {{{ setImmediate }}} and there is also the postMessage that we should probably try to take advantage of these. \ \ I would like to propose a {{{ jQuery.later( fn ) }}} that wraps the "best" possible function here. → We are starting to use more and more {{{ setTimeout( fn, 0 ); }}} calls around our code base. I think now that there is also a {{{ setImmediate }}} and there is also the postMessage that we should probably try to take advantage of these.\ \ I would like to propose a {{{ jQuery.later( fn ) }}} that wraps the "best" possible function here. |
---|
+1, mostly fluff, but honestly, I'm personally sick of setTimeout( fn, 0). Let's do it.
Changed December 14, 2011 04:34AM UTC by comment:11
description: | We are starting to use more and more {{{ setTimeout( fn, 0 ); }}} calls around our code base. I think now that there is also a {{{ setImmediate }}} and there is also the postMessage that we should probably try to take advantage of these.\ \ I would like to propose a {{{ jQuery.later( fn ) }}} that wraps the "best" possible function here. → We are starting to use more and more {{{ setTimeout( fn, 0 ); }}} calls around our code base. I think now that there is also a {{{ setImmediate }}} and there is also the postMessage that we should probably try to take advantage of these. \ \ I would like to propose a {{{ jQuery.later( fn ) }}} that wraps the "best" possible function here. |
---|
+1, Seems highly useful
Changed December 14, 2011 04:07PM UTC by comment:12
description: | We are starting to use more and more {{{ setTimeout( fn, 0 ); }}} calls around our code base. I think now that there is also a {{{ setImmediate }}} and there is also the postMessage that we should probably try to take advantage of these. \ \ I would like to propose a {{{ jQuery.later( fn ) }}} that wraps the "best" possible function here. → We are starting to use more and more {{{ setTimeout( fn, 0 ); }}} calls around our code base. I think now that there is also a {{{ setImmediate }}} and there is also the postMessage that we should probably try to take advantage of these.\ \ I would like to propose a {{{ jQuery.later( fn ) }}} that wraps the "best" possible function here. |
---|
-1, I don't think it's worth it
Changed December 16, 2011 12:21AM UTC by comment:13
+1
It should save size and it would really prevent jQuery users from bad usage of setTimeout. For example many developers still do things like:
setTimeout("a lot of javascript in a string", ...)
Changed January 04, 2012 07:01AM UTC by comment:14
I like the standardization and size neutrality (jquery.js has 5 instances of setTimeout( fn, 0..1 )
, making this cost at most 12 bytes minified). But how about calling it jQuery.soon
?
Changed January 09, 2012 05:36PM UTC by comment:15
description: | We are starting to use more and more {{{ setTimeout( fn, 0 ); }}} calls around our code base. I think now that there is also a {{{ setImmediate }}} and there is also the postMessage that we should probably try to take advantage of these.\ \ I would like to propose a {{{ jQuery.later( fn ) }}} that wraps the "best" possible function here. → We are starting to use more and more {{{ setTimeout( fn, 0 ); }}} calls around our code base. I think now that there is also a {{{ setImmediate }}} and there is also the postMessage that we should probably try to take advantage of these. \ \ I would like to propose a {{{ jQuery.later( fn ) }}} that wraps the "best" possible function here. |
---|---|
owner: | → gnarf |
status: | open → assigned |
Changed January 09, 2012 08:35PM UTC by comment:16
I'll elaborate. I don't think this will give us the benefit we're looking for. In terms of performance, adding the function call will likely negate the benefit of using postMessage. The best performance always has the smallest stack. Besides, we're talking ops in the millions if comparing postMessage to setTimeout. As for setImmediate, it is not currently implemented in any browser except IE and will probably never become part of the spec. IE10 will implement it as msSetImmediate. I definitely don't think we should make use of that yet.
It is my understanding that the overall direction for browser vendors is to optimize for setTimeout(fn, 0) rather than add another function. We could very well be forcing the jQuery API to go in a direction we will regret later. I'm not saying never, but I suggest we table it.
Changed June 11, 2012 08:41PM UTC by comment:17
Even if it doesn't wrap any other method, just having it wrap setTimeout( fn , 0 ) is nice
Changed July 14, 2012 02:08AM UTC by comment:18
We haven't done this yet in 1.8, but I'm also not seeing any place where it is going to save us anything in the current code. Thoughts? Should we push to 1.9 and discuss then?
Changed September 17, 2012 05:48PM UTC by comment:19
keywords: | 1.8-discuss → 1.9-discuss |
---|
Changed September 24, 2012 04:59PM UTC by comment:20
Thoughts about the benefits? The setTimeout
implementation adds a relatively large delay but is not a lot of code. I'm on the fence about it now.
Changed September 26, 2012 09:23PM UTC by comment:21
I'm neutral on this too, but +1 if it reduces size.
Changed October 14, 2012 10:21PM UTC by comment:22
+1, I'm with @gibson042 on this. If it's smaller, sure.
Changed October 14, 2012 11:18PM UTC by comment:23
+1, But we need to bikeshed on the naming
Changed October 22, 2012 05:17PM UTC by comment:24
+1, if it reduces size
Changed October 29, 2012 04:59PM UTC by comment:25
+1
Changed October 29, 2012 05:02PM UTC by comment:26
milestone: | None → 1.9 |
---|
Changed December 11, 2012 01:58AM UTC by comment:27
resolution: | → fixed |
---|---|
status: | assigned → closed |
Fix #10417. setTimeout w/o 2nd arg is jQuery.later! Close gh-1065.
Changeset: d41b983259042d3a07ae785c09f71c68d9ce7c3f
Changed January 15, 2013 02:13AM UTC by comment:28
summary: | jQuery.later → Remove second arg from setTimeout calls (WAS jQuery.later) |
---|