1chrome.extension.onConnect.addListener(function(port) { 2 port.onMessage.addListener(function(msg) { 3 port.postMessage({counter: msg.counter+1}); 4 }); 5}); 6 7chrome.extension.onRequest.addListener( 8 function(request, sender, sendResponse) { 9 sendResponse({counter: request.counter+1}); 10 }); 11