Skip to content

Commit

Permalink
fix(Throttle util) refactor method invocations in components, fixes m…
Browse files Browse the repository at this point in the history
…ethod not found #593
  • Loading branch information
gselderslaghs committed Jan 17, 2025
1 parent 65ddf18 commit 3a66e61
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 3a66e61

Please sign in to comment.