仅在弹出窗口打开时,我试图在background.js中运行某些内容。我知道如何在弹出窗口打开时发送警报,而不是在弹出窗口关闭时发送警报。
//当弹出窗口打开时,此消息从popup.js发送
chrome.runtime.onMessage.addListener(function(message,sender,sendResponse){
if (message.text == "popup opened") {
console.log ("Popup says it was opened.");
updateTime();
}
});
//这将在background.js中获取消息
BROWSE FIELDS Lastcall FOR year( Lastcall ) = 2019