我在开发浏览器插件的时候,在background.js中使用了chrome.runtime.onStartup,但是我在启动浏览器的时候并没有执行,我代码是这样写的(background.js中)
chrome.runtime.onStartup.addListener(() => {
console.log('!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!');
});
上面的console在浏览器启动的时候并没有执行,可以帮忙分析解决下吗
我在开发浏览器插件的时候,在background.js中使用了chrome.runtime.onStartup,但是我在启动浏览器的时候并没有执行,我代码是这样写的(background.js中)
chrome.runtime.onStartup.addListener(() => {
console.log('!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!');
});
上面的console在浏览器启动的时候并没有执行,可以帮忙分析解决下吗
onStartup
chrome.runtime.onStartup.addListener(
callback: function,
)
Fired when a profile that has this extension installed first starts up. This event is not fired when an incognito profile is started, even if this extension is operating in 'split' incognito mode.
官方的解释,某个Chrome配置第一次安装扩展时触发,并非每次启动浏览器时触发。卸载掉扩展,然后再安装试试