我正在开发本机消息传递应用程序。我创建了以下文件
1.C++ conole app 2.JS 文件 3.manifet 文件 我已经创建了这样的注册表项
现在我在行port = chrome.runtime.connectNative(hostName);中遇到错误 .我注意到 chrome.runtime 本身是未定义的。让我知道我在这里遗漏了什么。
清单.jason
function connect() {
//var m1 = chrome.runtime.getManifest();
var hostName = "NM1";
var t1 = chrome;
appendMessage("Connecting to native messaging host <b>" + hostName + "</b>")
port = chrome.runtime.connectNative(hostName);
port.onMessage.addListener(onNativeMessage);
port.onDisconnect.addListener(onDisconnected);
updateUiState();
}
main.js
function connect() {
//var m1 = chrome.runtime.getManifest();
var hostName = "NM1";
appendMessage("Connecting to native messaging host <b>" + hostName + "</b>")
port = chrome.runtime.connectNative(hostName);
port.onMessage.addListener(onNativeMessage);
port.onDisconnect.addListener(onDisconnected);
updateUiState();
}