1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 chrome.runtime.onConnect.addListener(function(port) { 6 port.onMessage.addListener(function(msg) { 7 port.postMessage({counter: msg.counter+1}); 8 }); 9 }); 10 11 chrome.extension.onRequest.addListener( 12 function(request, sender, sendResponse) { 13 sendResponse({counter: request.counter+1}); 14 }); 15