Apparently it's not necessary to write :
// And now we create a promise from this // instruction so we can chain it var deferred = $.Deferred(); deferred.resolve(instruction); return deferred.promise();
Why? I hear you ask? Because of the Monad pattern.
What's a monad? Good question. Read the book this guy wrote on Stack Overflow - http://stackoverflow.com/a/28947696/896697 - where he takes my answer and explains why I shouldn't have written it that way ...
No comments:
Post a Comment