-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 3/29/11 9:16 AM, Mark McDonnell wrote: > I did take a look at the Promises/A implementations but they were for > server-side solutions and so tied into their own API terminology in > places and was just confusing to follow along to.
Actually, Kris Zyp's Promised-IO promises/deferreds can be easily transformed into a client-side solution. I did so in uber.js: https://github.com/phiggins42/uber.js/blob/master/lib/Deferred.js https://github.com/phiggins42/uber.js/blob/master/lib/when.js It's quite simple. Another good implementation is Dojo's: http://svn.dojotoolkit.org/src/tags/release-1.6.0/dojo/_base/Deferred.js If you're looking for a non-server-side and simple implementation of Promise/A, uber.js or Dojo are probably your best bets. Everything in both (including chaining) works to the Promise/A spec, whereas jQuery's implementation doesn't (http://jsfiddle.net/brianarn/2tuWf/). As for a Deferred working with AJAX, both Dojo and uber.js implement them: http://svn.dojotoolkit.org/src/tags/release-1.6.0/dojo/_base/xhr.js https://github.com/phiggins42/uber.js/blob/master/lib/xhr.js Again, uber.js's implementation is a bit simpler, but both return a deferred/promise that will chain according to spec. Hopefully this helps. - -- Bryan Forbes http://www.reigndropsfall.net GPG Fingerprint 3D7D B728 713A BB7B B8B1 5B61 3888 17E0 70CA 0F3D -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk2R/hoACgkQOIgX4HDKDz0QwACdEjv7oqLXU4OqQQwS8SnHgPhy BNcAnAwEcd4YcBMY8WV7QPn72/zOCgUu =zPm/ -----END PGP SIGNATURE----- -- To view archived discussions from the original JSMentors Mailman list: http://www.mail-archive.com/[email protected]/ To search via a non-Google archive, visit here: http://www.mail-archive.com/[email protected]/ To unsubscribe from this group, send email to [email protected]
