@aurigma/design-atoms-model
Version:
Design Atoms is a part of Customer's Canvas SDK which allows for manipulating individual design elements through your code.
25 lines • 838 B
JavaScript
import { isObject } from "./Utils";
import { debounce } from "./debounce";
/** Error message constants. */
var FUNC_ERROR_TEXT = 'Expected a function';
/**
* This is copy a function of lodash. See docs lodash.throttle. Please do not use this outside Design Atoms.
* @deprecated
* @hidden
*/
export function throttle(func, wait, options) {
var leading = true, trailing = true;
if (typeof func != 'function') {
throw new TypeError(FUNC_ERROR_TEXT);
}
if (isObject(options)) {
leading = 'leading' in options ? !!options.leading : leading;
trailing = 'trailing' in options ? !!options.trailing : trailing;
}
return debounce(func, wait, {
'leading': leading,
'maxWait': wait,
'trailing': trailing
});
}
//# sourceMappingURL=throttle.js.map