mirror of
https://github.com/grafana/grafana.git
synced 2025-07-31 12:32:13 +08:00
14 lines
311 B
TypeScript
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);
|
|
};
|