Skip to content

Commit

Permalink
Merge pull request #594 from gselderslaghs/throttle-util-method-invoc…
Browse files Browse the repository at this point in the history
…ation-fixes

fix(Throttle util) refactor method invocations in components, fixes m…
  • Loading branch information
wuda-io authored Jan 30, 2025
2 parents 4b46164 + 3a66e61 commit f6bdfa4
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 10 deletions.
6 changes: 2 additions & 4 deletions src/carousel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,10 +240,8 @@ export class Carousel extends Component<CarouselOptions> {
window.removeEventListener('resize', this._handleThrottledResize);
}

_handleThrottledResize: () => void = Utils.throttle(
function () {
this._handleResize();
},
_handleThrottledResize = (): void => Utils.throttle(
this._handleResize,
200,
null
).bind(this);
Expand Down
4 changes: 1 addition & 3 deletions src/scrollspy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,7 @@ export class ScrollSpy extends Component<ScrollSpyOptions> {
}
}

_handleThrottledResize: () => void = Utils.throttle(function () {
this._handleWindowScroll();
}, 200).bind(this);
_handleThrottledResize = (): void => Utils.throttle(this._handleWindowScroll, 200).bind(this);

_handleTriggerClick = (e: MouseEvent) => {
const trigger = e.target;
Expand Down
4 changes: 1 addition & 3 deletions src/tapTarget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,7 @@ export class TapTarget extends Component<TapTargetOptions> implements Openable {
window.removeEventListener('resize', this._handleThrottledResize);
}

_handleThrottledResize: () => void = Utils.throttle(function () {
this._handleResize();
}, 200).bind(this);
_handleThrottledResize = (): void => Utils.throttle(this._handleResize, 200).bind(this);

_handleKeyboardInteraction = (e: KeyboardEvent) => {
if (Utils.keys.ENTER.includes(e.key)) {
Expand Down

0 comments on commit f6bdfa4

Please sign in to comment.