cujojs / when

A solid, fast Promises/A+ and when() implementation, plus other async goodies.
Other
3.44k stars 396 forks source link

Is there a way to convert Jquery Promise to When Promise #453

Closed Maatary closed 9 years ago

campersau commented 9 years ago

You can just wrap other promises with when(otherPromise) For example:

var whenPromise = when(jQuery.ready.promise());

You can read more about it here: https://github.com/cujojs/when/wiki/when#non-compliant-promises

briancavalier commented 9 years ago

Thanks for jumping in @campersau. That exactly right, and is the simplest way. Also info here: https://github.com/cujojs/when/blob/master/docs/api.md#when

Note that when(x) and when.resolve(x) basically do the same thing, as does Promise.resolve(x) if you're using the ES6 Promise shim.

Closing, but please feel free to continue to discuss, or reopen if you need, @Maatary