<story><title>JavaScript Promises in Wicked Detail</title><url>http://mattgreer.org/articles/promises-in-wicked-detail/</url></story><parent_chain></parent_chain><comment><author>exogen</author><text>The situation caused by promises gaining popularity and non-IE browsers refusing to implement setImmediate is really quite ugly. setTimeout&amp;#x27;s minimum value is defined to be 4ms by the HTML5 spec, so if the browser conforms to that and your app makes heavy use of promises (using setTimeout), now you&amp;#x27;re waiting multiple screen refreshes for updates – so you don&amp;#x27;t actually want to use setTimeout. Even though the asynchronous requirement is good for developers using the promise API, it really screwed over implementors.&lt;p&gt;The setImmediate polyfills attempt a bunch of ugly fallbacks, including (depending on which one you use): yield&amp;#x2F;generators, MutationObserver, postMessage&amp;#x2F;MessageChannel, onreadystatechange, and finally setTimeout (the slowest).&lt;p&gt;IMO the browser vendors should just give in and add setImmediate – if ever there was a need for it, this is it. But maybe they consider ES6 features a good enough substitute, I don&amp;#x27;t know.</text></comment>
<story><title>JavaScript Promises in Wicked Detail</title><url>http://mattgreer.org/articles/promises-in-wicked-detail/</url></story><parent_chain></parent_chain><comment><author>enraged_camel</author><text>This is off-topic, but there seems to be this trend on HN (and probably similar sites) where a post about Topic X will get a lot of comments&amp;#x2F;views, and the following several days similar posts will appear on the front page, in the format of &amp;quot;Why You Should Never Do X&amp;quot; or &amp;quot;A Better Way to Do X&amp;quot;.&lt;p&gt;What I&amp;#x27;m wondering is whether this is some sort of bias on my part (I tend to notice them because my memory of the original post is still fresh), or whether the subsequent stories are upvoted to the front-page because people want to discuss the topic more. And from the author&amp;#x27;s perspective, whether they are writing it to take advantage of the opportunity for increased page-views.</text></comment>