Add support for live updating in chrome

This commit is contained in:
Ajay
2023-07-29 01:41:57 -04:00
parent 90bb9a4d02
commit dc91ee76ca
7 changed files with 87 additions and 24 deletions

View File

@@ -13,6 +13,7 @@ import { DEFAULT_CATEGORY, shortCategoryName } from "../utils/categoryUtils";
import { normalizeChapterName } from "../utils/exporter";
import { getFormattedTimeToSeconds } from "../maze-utils/formating";
import { findValidElement } from "../maze-utils/dom";
import { addCleanupListener } from "../maze-utils/cleanup";
const TOOLTIP_VISIBLE_CLASS = 'sponsorCategoryTooltipVisible';
const MIN_CHAPTER_SIZE = 0.003;
@@ -201,6 +202,10 @@ class PreviewBar {
childList: true,
subtree: true,
});
addCleanupListener(() => {
observer.disconnect();
});
}
private setTooltipTitle(segment: PreviewBarSegment, tooltip: HTMLElement): void {
@@ -626,6 +631,11 @@ class PreviewBar {
childListObserver.observe(this.originalChapterBar, {
childList: true
});
addCleanupListener(() => {
attributeObserver.disconnect();
childListObserver.disconnect();
});
}
private updateChapterAllMutation(originalChapterBar: HTMLElement, progressBar: HTMLElement, firstUpdate = false): void {