We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 04aa945 commit e4d7943Copy full SHA for e4d7943
content.js
@@ -247,12 +247,10 @@
247
// 开始观察
248
observer.observe(targetNode, config);
249
250
- // 初始注入,确保页面加载时就存在按钮和列表
251
- injectPinButton();
252
- injectPinList();
253
-
254
chrome.storage.onChanged.addListener((changes, area) => {
+ console.log('storage changed');
255
if (area === 'local' && changes.pinnedChats) {
+ console.log('pinnedChats changed');
256
updatePinList();
257
updatePinButton();
258
}
devlog.md
@@ -76,6 +76,7 @@ observer.observe(targetNode, config);
76
**解决方案:**
77
78
采用 **去抖动 (Debouncing)** 技术来限制 `MutationObserver` 回调函数的执行频率。去抖动函数可以确保在事件被触发后,延迟一段时间执行回调函数。如果在这段时间内事件再次被触发,则重新计时。通过去抖动,可以确保在 React 渲染完成后只执行一次注入操作,避免重复添加元素。
79
+而且使用去抖以后,也不需要再进行初始注入了。
80
81
**代码摘要:**
82
0 commit comments