Issues (576)

src/shared/lib/throttle.ts (1 issue)

Severity
1
const throttle = (fn: () => void, ms: number) => {
2
  let prev: number = 0
0 ignored issues
show
Type number trivially inferred from a number literal, remove type annotation.
Loading history...
3
4
  return () => {
5
    const now: number = new Date().valueOf()
6
7
    if (now - prev >= ms) {
8
      fn()
9
      prev = now
10
    }
11
  }
12
}
13
14
export { throttle }
15