feat: 增加获取图片源地址功能
This commit is contained in:
@@ -9,15 +9,12 @@ export default defineContentScript({
|
||||
|
||||
const collector = new PinCollector();
|
||||
// 首次加载自动收集并存储
|
||||
const pins = collector.collect();
|
||||
if (pins.length > 0) {
|
||||
collector.saveToStorage();
|
||||
}
|
||||
|
||||
// 允许 popup 主动触发重新收集
|
||||
browser.runtime.onMessage.addListener((msg, sender, sendResponse) => {
|
||||
if (msg.type === 'COLLECT_PINS') {
|
||||
const updatedPins = collector.collect();
|
||||
sendResponse({ success: true, count: updatedPins.length });
|
||||
const pins = collector.collect();
|
||||
sendResponse({ success: true, count: pins.length, pins });
|
||||
return true; // 异步响应
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user