$.get的重写

 1 window.meng = window.meng || {};
 2 (function () {
 3 
 4     function Get() {
 5         this.def = $.Deferred();
 6     }
 7 
 8     Get.prototype.request = function (url) {
 9         $.get(url, function (data) {
10             this.def.resolve(data);
11         }.bind(this));
12         return this.def;
13     };
14     meng.Get = Get;
15 })();

网上的一篇好文章:http://www.ruanyifeng.com/blog/2011/08/a_detailed_explanation_of_jquery_deferred_object.html

posted @ 2016-10-25 20:04  晨落梦公子  阅读(197)  评论(0编辑  收藏  举报