- Context - sync _tilts_ between participants - shiny cards - reconnect clients - updates Settings - re-animate Switches Co-authored-by: Gavin McDonald <gavinmcdoh@gmail.com> Reviewed-on: #3
13 lines
231 B
TypeScript
13 lines
231 B
TypeScript
export default function throttle(func: Function, threshold: number) {
|
|
let lastCall = 0;
|
|
|
|
return (...args: any[]) => {
|
|
const now = Date.now();
|
|
|
|
if (now - lastCall >= threshold) {
|
|
lastCall = now;
|
|
func(...args);
|
|
}
|
|
};
|
|
}
|