I need a way to debounce an event emitted by clarity datagrid so that I only fetch data from back end after user has finished typing. I'm using the grid within an angular 6 application and bind the event to my function. My setup is as follows,
<clr-datagrid (clrDgRefresh)="fetchData($event)"></clr-datagrid>
fetchData(state) {
// Fetch data from back end
}
How do I debounce the event so it does not trigger my fetchData function on each keyup? I don't have a handle to any of the datagrids filter inputs neither do I know how many inputs there will be. All I have is an event that is triggered when there's a key up on any of the grid filter inputs.