JS建造者模式

mac2022-06-30  91

function getBeerById( id, callback){ _request('GET','URL'+id,function(res){ callback(res.responseText) }); }; function getBeerByIdBridge(){ getBeerById(id,function(res){ alert(res.toString()); }); //doAnothering; }; var el = document.querySelector('#test'); el.addEventListener('click',getBeerByIdBrige,false);

所谓的建造者模式跟桥接模式一样好像,就是常见的回调,让思路更加清晰一点点

转载于:https://www.cnblogs.com/diligenceday/p/3429896.html

相关资源:JS建造者模式基本用法实例分析
最新回复(0)