| OLD | NEW |
| 1 function onRequest(request, sender, callback) { | 1 function onRequest(request, sender, callback) { |
| 2 var response = JSON.stringify(request); | 2 var response = JSON.stringify(request); |
| 3 callback("onRequest callback: " + response); | 3 callback("onRequest callback: " + response); |
| 4 } | 4 } |
| 5 | 5 |
| 6 chrome.extension.onRequest.addListener(onRequest); | 6 chrome.extension.onRequest.addListener(onRequest); |
| 7 | 7 |
| 8 function onMessage(port, message) { | 8 function onMessage(port, message) { |
| 9 port.postMessage("port.onMessage: " + message); | 9 port.postMessage("port.onMessage: " + message); |
| 10 } | 10 } |
| 11 | 11 |
| 12 function onConnect(port) { | 12 function onConnect(port) { |
| 13 port.onMessage.addListener(onMessage.bind(null, port)); | 13 port.onMessage.addListener(onMessage.bind(null, port)); |
| 14 } | 14 } |
| 15 | 15 |
| 16 chrome.extension.onConnect.addListener(onConnect); | 16 chrome.runtime.onConnect.addListener(onConnect); |
| OLD | NEW |