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.
5 function onRequest(request, sender, callback) {
6 var response = JSON.stringify(request);
7 callback("onRequest callback: " + response);
10 chrome.extension.onRequest.addListener(onRequest);
12 function onMessage(port, message) {
13 port.postMessage("port.onMessage: " + message);
16 function onConnect(port) {
17 port.onMessage.addListener(onMessage.bind(null, port));
20 chrome.runtime.onConnect.addListener(onConnect);