Farmbot-Web-App/frontend/connectivity/slow_down.ts

7 lines
241 B
TypeScript
Raw Normal View History

2019-01-24 13:36:12 -07:00
import { throttle } from "lodash";
/** Too many status updates === too many screen redraws. */
export const slowDown =
<Returns, Args, Fn extends (u: Args) => Returns>(fn: Fn) =>
2019-01-24 13:36:12 -07:00
throttle(fn, 600, { leading: false, trailing: true });