添加一个 onMessage-listener 可以防止我的 onInstalled-listener 触发。为什么?
这是我的代码:
清单.json
{
"name": "BUGTESTER",
"description": "Hmmmmm...",
"version": "0.1",
"background": {
"persistent": false,
"scripts": ["background.js"]
},
"manifest_version": 2
}
背景.js
chrome.runtime.onInstalled.addListener(function() {
alert("onInstalled");
});
//Adding this line breaks the onInstalled-thingy
chrome.extension.onMessage.addListener(function(msg, sender, sendResponse) {});