Refactor visibility observer initialization and remove debounce logic
This commit is contained in:
@@ -175,6 +175,7 @@
|
|||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
pointer-events: auto;
|
pointer-events: auto;
|
||||||
|
outline: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
#slides-container[style*="display: none"],
|
#slides-container[style*="display: none"],
|
||||||
|
|||||||
@@ -1489,12 +1489,12 @@ const VisibilityObserver = {
|
|||||||
*/
|
*/
|
||||||
init() {
|
init() {
|
||||||
// MARK: Mark
|
// MARK: Mark
|
||||||
// const observer = new MutationObserver(() => this.updateVisibility());
|
const observer = new MutationObserver(() => this.updateVisibility());
|
||||||
let debounceTimer = null;
|
// let debounceTimer = null;
|
||||||
const observer = new MutationObserver(() => {
|
// const observer = new MutationObserver(() => {
|
||||||
if (debounceTimer) clearTimeout(debounceTimer);
|
// if (debounceTimer) clearTimeout(debounceTimer);
|
||||||
debounceTimer = setTimeout(() => this.updateVisibility(), 250);
|
// debounceTimer = setTimeout(() => this.updateVisibility(), 250);
|
||||||
});
|
// });
|
||||||
observer.observe(document.body, { childList: true, subtree: true });
|
observer.observe(document.body, { childList: true, subtree: true });
|
||||||
|
|
||||||
document.body.addEventListener("click", () => this.updateVisibility());
|
document.body.addEventListener("click", () => this.updateVisibility());
|
||||||
|
|||||||
Reference in New Issue
Block a user