个人理解:桥接模式就是更进一步地封装已有api,通过这个封装连接你的输入和底层api(初步理解,以后加深理解有不同体会之后可能要修改)
function getBeerById(id, callback) { // Make request for beer by ID, then return the beer data. asyncRequest(‘GET‘, ‘beer.uri?id=‘ + id, function(resp) { // callback response callback(resp.responseText); }); }
addEvent(element, ‘click‘, getBeerById); function getBeerById(e) { var id = this.id; asyncRequest(‘GET‘, ‘beer.uri?id=‘ + id, function(resp) { // Callback response. console.log(‘Requested Beer: ‘ + resp.responseText); }); }
var Class1 = function(a, b, c) { this.a = a; this.b = b; this.c = c; } var Class2 = function(d) { this.d = d; }; var BridgeClass = function(a, b, c, d) { this.one = new Class1(a, b, c); this.two = new Class2(d); };
原文:http://www.cnblogs.com/oadaM92/p/4368332.html