1
0
Code Issues Pull Requests Packages Projects Releases Wiki Activity GitHub Gitee
xiaomo-chrome-extension/scripts/content.js

15 lines
469 B
JavaScript
Raw Normal View History

2023-01-07 05:13:26 +08:00
console.log("[小墨助手]", "插件已启用")
// 每次改变开关状态时刷新页面使功能及时生效
chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
console.log(`进入 scripts/content.js 的 onMessage Listener`)
if (request.action === 'refreshPage') {
location.reload();
sendResponse('Reload page because of ' + request.info);
}
console.log(`离开 scripts/content.js 的 onMessage Listener`)
return true;
})