|
Last change
on this file was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago |
|
Added visualizations
|
-
Property mode
set to
100644
|
|
File size:
293 bytes
|
| Line | |
|---|
| 1 | import { debounce } from './debounce.mjs';
|
|---|
| 2 |
|
|---|
| 3 | function throttle(func, throttleMs = 0, options = {}) {
|
|---|
| 4 | const { leading = true, trailing = true } = options;
|
|---|
| 5 | return debounce(func, throttleMs, {
|
|---|
| 6 | leading,
|
|---|
| 7 | maxWait: throttleMs,
|
|---|
| 8 | trailing,
|
|---|
| 9 | });
|
|---|
| 10 | }
|
|---|
| 11 |
|
|---|
| 12 | export { throttle };
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.