index

Q

Promise Methods

Most promise methods have "static" counterparts on the main Q object, which will accept either a promise or a non-promise, and in the latter case create a fulfilled promise first. For example, Q.when(5, onFulfilled) is equivalent to Q(5).then(onFulfilled). All others have static counterparts that are named the same as the promise method.

Some methods are named the same as JavaScript reserved words, like try, catch, and finally. This helps show the very clear parallel between standard synchronous language constructs and asynchronous promise operations. However, such use of words as property names is only supported as of the ECMAScript 5 edition of the JavaScript language, which isn't implemented in certain older browsers like IE8, Safari 5, Android 2.2, or PhantomJS 1.8. If you're targeting those browsers, and aren't using a lan