W3C home > Mailing lists > Public > public-web-perf@w3.org > July 2011

Re: Open Source Cross-Browser setImmediate in JavaScript

From: Paul Bakaus <pbakaus@zynga.com>
Date: Mon, 4 Jul 2011 08:13:33 -0700
To: Donavon West <dwest@book.com>, "public-web-perf@w3.org" <public-web-perf@w3.org>
Message-ID: <CA37A4F9.AB3D%pbakaus@zynga.com>
Hi Donavon,

I definitely like this, as process.nextTick seems very efficient. I'm
wondering though if you could give an explanation of the actual difference
between setTimeout and setImmediate. I, for instance, often use it to wait
for reflows and repaints.


Am 02.07.11 06:43 schrieb "Donavon West" unter <dwest@book.com>:

>I wrote Jason Weber and he turned me on to this group. Our desktop
>Mac/PC applications use Webkit to create a custom "harness" for our NOOK
>Study higher education ereader (http://nookstudy.com). It looks and
>feels like a native desktop app, but uses web based technologies under
>the hood. As such, we have thousands of lines of rather intense
>JavaScript/HTML5/CSS3 code. As a developer, I really appreciate a faster
>setTimeout(0) alternative and advocate for getting setImmediate into
>future browsers.
>I've written a cross-browser JavaScript implementation of setImmediate
>along with a QUnit test suite (which could be used to test browser
>implementations as well). It is open source and you can get it at
>https://github.com/NobleJS/setImmediate (if you build on the tests,
>please update GitHub).
>My thoughts on the setImmediate API:
>* personally I think that making it semantically identical to the
>setTimeout API was overkill. A simple node.js process.nextTick would
>suffice. I don't think anyone will ever call setImmediate and then clear
>it. However,  for the sake of completeness it doesn't hurt to leave it
>in (you can simply ignore the returned handle).
>* please remove the case for a string eval'ed handler argument. Stop the
>madness! Stop it now!
>Donavon West
>Software Development Manager
>Barnes and Noble.com
>This electronic mail message contains information that (a) is or
>BY LAW FROM DISCLOSURE, and (b) is intended only for the use of
>the addressee(s) named herein.  If you are not an intended
>recipient, please contact the sender immediately and take the
>steps necessary to delete the message completely from your
>computer system.
>Not Intended as a Substitute for a Writing: Notwithstanding the
>Uniform Electronic Transaction Act or any other law of similar
>effect, absent an express statement to the contrary, this e-mail
>message, its contents, and any attachments hereto are not
>to represent an offer or acceptance to enter into a contract and
>are not otherwise intended to bind this sender,
>llc, barnesandnoble.com inc. or any other person or entity.
Received on Monday, 4 July 2011 15:14:04 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 18:01:08 UTC