Hahazhu

摘要: var Promise=function(args){ this.callback=[]; var _this=this; setTimeout(function() { _this.done(); }, 0);};Promise.prototype.then=function(res... 阅读全文
posted @ 2014-12-04 19:06 hahazhu 阅读(151) 评论(0) 推荐(0)
摘要: The following is the core concept to javascript Asychnoous Promise Pattern, you can extend it a little bit to realize the starndard API: .when(),.then(),.resolved(),.reject()This is just a mock.function Ajax(promise){ var result=promise||{}; setTimeout(function(){ result.id="_id"; },5000); 阅读全文
posted @ 2013-10-31 09:38 hahazhu 阅读(298) 评论(0) 推荐(0)