📜  从扩展程序到后台页面进行通信 - 任何代码示例

📅  最后修改于: 2022-03-11 14:56:33.578000             🧑  作者: Mango

代码示例2
var port = chrome.extension.connect({
      name: "Sample Communication"
 });
 port.postMessage("Hi BackGround");
 port.onMessage.addListener(function(msg) {
      console.log("message recieved" + msg);
 });