Permalink
Browse files

IMPROVED: calling promise()

  • Loading branch information...
1 parent 48c6de6 commit 306b5c033bbbe2c36edd94659b30ab3827ea5511 @warpdesign committed Jul 27, 2011
Showing with 14 additions and 5 deletions.
  1. +11 −4 README.md
  2. +3 −1 js/deferred.js
View
@@ -1,9 +1,9 @@
-StandaloneDeferred alpha 1
-==========================
+Standalone-Deferred
+==================
deferred.js is a standalone implementation of deferreds aims to be fully compatible with $.Deferred found in jQuery 1.5+.
-This version has been tested with only a few examples: it may (and will likely!) contains bugs and incompatibilites.
+This version has been tested with only a few examples: it may contains bugs and incompatibilites.
Usage
@@ -28,7 +28,7 @@ Unlike jQuery.Deferred, deferred must be called with the new keyword (this will
}
// Attach a done and fail handler for the asyncEvent
- asyncEvent().then(
+ Deferred.when(asyncEvent()).then(
function(status){
console.log( status+', things are going well' );
},
@@ -37,6 +37,13 @@ Unlike jQuery.Deferred, deferred must be called with the new keyword (this will
}
);
+
+What's Missing ?
+----------------
+
+Standalone-Deferred currently doesn't implement the pipe method found inside jQuery Deferreds.
+
+
Contact
-------
View
@@ -30,9 +30,11 @@
this.isRejected = bind(d.isRejected, d, this);
}
+ P.prototype.promise = function() { return this; }
+
D.when = function() {
if (arguments.length == 1)
- return (arguments[0].constructor === D) ? arguments[0].promise() : arguments[0];
+ return arguments[0].promise();
else if (arguments.length > 1)
{
return (function(args){

0 comments on commit 306b5c0

Please sign in to comment.