tripnomics_7.5.5/public/app/plugins/datasource/cloudwatch/memoizedDebounce.ts
venbatechnologies@gmail.com 91fce5c4bf Initial commit
2021-07-05 13:49:40 +05:30

14 lines
312 B
TypeScript

import { debounce, memoize } from 'lodash';
export default (func: (...args: any[]) => void, wait = 7000) => {
const mem = memoize(
(...args) =>
debounce(func, wait, {
leading: true,
}),
(...args) => JSON.stringify(args)
);
return (...args: any[]) => mem(...args)(...args);
};