标签:style blog color io ar div cti log sp
修改很简单,通过参数判断,然后返回下promise对象
(function() { var timeout = setTimeout; window.setTimeout = function(fn, time) { if (!time) { time = fn; return $.Deferred(function(dfd) { timeout(function() { dfd.resolvel(dfd); }, time); }).promise(); } timeout.apply(window, arguments); } })();
调用
setTimeout(1000).done(function(dnt) { console.log(dnt) })
标签:style blog color io ar div cti log sp
原文地址:http://www.cnblogs.com/aaronjs/p/3951732.html