grafana/public/app/plugins/datasource/cloudwatch/memoizedDebounce.ts
Ashley Harrison b3cff22db3
Chore: Improve types (#85659)
* fixing some types

* more type fixes

* few more

* last couple

* tiny tweak
2024-04-08 09:56:21 +01:00

14 lines
311 B
TypeScript

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