Permalink
Browse files

notes on using Promises with Class instances.

  • Loading branch information...
1 parent 22542d8 commit 73a3cbcc89070b35ac6474198ef8535340863f29 @swannodette swannodette committed Jul 21, 2009
Showing with 3 additions and 2 deletions.
  1. +1 −2 Promises.js
  2. +2 −0 examples/exampleB.js
View
@@ -5,8 +5,7 @@
http://en.wikipedia.org/wiki/Futures_and_promises
*/
-// hopefully wrap in 2.0 uses the method mutator
-// we put a reference to the wrapper on the fn
+// we need a backreference to wrapper
Class.extend({
wrap: function(self, key, method)
{
@@ -28,6 +28,8 @@ var MySubClass = new Class({
add: function(a, b)
{
+ // remember by this point a and b are realized
+ // we're not sending promises to parent!
return this.parent(a, b) + "!";
}.decorate(promise)
});

0 comments on commit 73a3cbc

Please sign in to comment.