老师出一个讲一步操作的视频吧,$.deffered是怎么实现的啊
// var def = $.Deferred(); // require(['./app/user'], function(user) { // abc.resolve(user); // // def.resolve(user); // }); // return def; // ES6 Promise var result = new Promise(function(resolve, reject){ require(['./app/user'], function(user) { resolve(user); }); }); return result;
参考:http://www.ruanyifeng.com/blog/2011/08/a_detailed_explanation_of_jquery_deferred_object.html