Skip to content

Commit

Permalink
Merge pull request #31 from hirasso/feat/use-passive-true
Browse files Browse the repository at this point in the history
feat: make scroll event handler passive
  • Loading branch information
hirasso authored Oct 22, 2024
2 parents c3b8426 + 7a45ee9 commit c99e890
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/ScrollMirror.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
import type { Progress, Options, Logger } from "./support/defs.js";
import {
getScrollProgress,
hasOverflow,
nextTick,
} from "./support/helpers.js";
import { getScrollProgress, hasOverflow, nextTick } from "./support/helpers.js";

import {
getScrollEventTarget,
Expand All @@ -22,7 +18,7 @@ export default class ScrollMirror {
readonly defaults: Options = {
vertical: true,
horizontal: true,
debug: true
debug: true,
};
/** The parsed options */
options: Options;
Expand Down Expand Up @@ -84,7 +80,7 @@ export default class ScrollMirror {
this.removeScrollHandler(element);

const target = getScrollEventTarget(element);
target.addEventListener("scroll", this.handleScroll);
target.addEventListener("scroll", this.handleScroll, { passive: true });
}

/** Remove the scroll handler from an element @internal */
Expand Down

0 comments on commit c99e890

Please sign in to comment.