mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
14 lines
312 B
TypeScript
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);
|
||
|
|
};
|