I have a method defined like this
updateHook(obj) {
// update the item
}
// https://www.npmjs.com/package/throttle-debounce
const update = debounce(updateHook, 2000);
I want to merge all the params and call it once if the method is called multiple times within 2 seconds e.g.
update({ name: 'abc' }); // first call
update({ city: 'def' }); // second call
update({ cell: 123 }); // third call
.... ~2 seconds
// should send one call to update with all the params merged like
update({ name: 'abc', city: 'def', cell: 123 });
NOTE: Its not required to use debounce, the requirement is I just want to call a method with merged params if that method is called multiple times during a time period of 2 seconds.