Returns a debounced version of the provided function that delays its
execution until a certain amount of time has passed since the last time it was called.
Parameters
fn: fn
The function to be debounced.
delay: number = 500
The number of milliseconds to wait before executing the function.
Returns a debounced version of the provided function that delays its execution until a certain amount of time has passed since the last time it was called.