Home / Function/ throttle() — vite Function Reference

throttle() — vite Function Reference

Architecture documentation for the throttle() function in reporter.ts from the vite codebase.

Entity Profile

Dependency Diagram

graph TD
  1da02f23_3691_1a34_a3f2_2801d80e06ce["throttle()"]
  a18c7381_7b31_1a3c_d997_50b979d5f107["reporter.ts"]
  1da02f23_3691_1a34_a3f2_2801d80e06ce -->|defined in| a18c7381_7b31_1a3c_d997_50b979d5f107
  573ab5b5_1ca7_8516_40b9_cab59ab7a7c0["buildReporterPlugin()"]
  573ab5b5_1ca7_8516_40b9_cab59ab7a7c0 -->|calls| 1da02f23_3691_1a34_a3f2_2801d80e06ce
  style 1da02f23_3691_1a34_a3f2_2801d80e06ce fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/vite/src/node/plugins/reporter.ts lines 379–388

function throttle(fn: Function) {
  let timerHandle: NodeJS.Timeout | null = null
  return (...args: any[]) => {
    if (timerHandle) return
    fn(...args)
    timerHandle = setTimeout(() => {
      timerHandle = null
    }, 100)
  }
}

Domain

Subdomains

Frequently Asked Questions

What does throttle() do?
throttle() is a function in the vite codebase, defined in packages/vite/src/node/plugins/reporter.ts.
Where is throttle() defined?
throttle() is defined in packages/vite/src/node/plugins/reporter.ts at line 379.
What calls throttle()?
throttle() is called by 1 function(s): buildReporterPlugin.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free