fix: lighten debounce() usage, do not do full re-render on every change

This commit is contained in:
2025-11-20 14:09:43 +03:00
parent dfdc1742ec
commit 348d64f356
3 changed files with 43 additions and 49 deletions

View File

@@ -2,7 +2,6 @@ import { HighlightList, MessageData } from '../types.js';
import { StorageService } from '../services/StorageService.js';
import { MessageService } from '../services/MessageService.js';
import { HighlightEngine } from './HighlightEngine.js';
import { DOMUtils } from '../utils/DOMUtils.js';
export class ContentScript {
private lists: HighlightList[] = [];
@@ -22,7 +21,6 @@ export class ContentScript {
private async initialize(): Promise<void> {
await this.loadSettings();
this.setupMessageListener();
this.setupScrollHandler();
this.processHighlights();
}
@@ -67,10 +65,6 @@ export class ContentScript {
});
}
private setupScrollHandler(): void {
const debouncedProcess = DOMUtils.debounce(() => this.processHighlights(), CONSTANTS.DEBOUNCE_DELAY);
window.addEventListener('scroll', debouncedProcess);
}
private async handleWordListUpdate(): Promise<void> {
const data = await StorageService.get(['lists']);