* Creates a function that, when executed, will only call the `func` function * at most once per every `wait` milliseconds. Provide an options object to * indicate that `func` should be invoked on the leading and/or trailing edge * of the `wait` timeout. Subsequent calls to the throttl
(func, wait, options)
| 40828 | * })); |
| 40829 | */ |
| 40830 | function throttle(func, wait, options) { |
| 40831 | var leading = true, |
| 40832 | trailing = true; |
| 40833 | |
| 40834 | if (!isFunction(func)) { |
| 40835 | throw new TypeError; |
| 40836 | } |
| 40837 | if (options === false) { |
| 40838 | leading = false; |
| 40839 | } else if (isObject(options)) { |
| 40840 | leading = 'leading' in options ? options.leading : leading; |
| 40841 | trailing = 'trailing' in options ? options.trailing : trailing; |
| 40842 | } |
| 40843 | debounceOptions.leading = leading; |
| 40844 | debounceOptions.maxWait = wait; |
| 40845 | debounceOptions.trailing = trailing; |
| 40846 | |
| 40847 | return debounce(func, wait, debounceOptions); |
| 40848 | } |
| 40849 | |
| 40850 | /** |
| 40851 | * Creates a function that provides `value` to the wrapper function as its |
nothing calls this directly
no test coverage detected