Home / Type/ NormalizedHotChannel Type — vite Architecture

NormalizedHotChannel Type — vite Architecture

Architecture documentation for the NormalizedHotChannel type/interface in hmr.ts from the vite codebase.

Entity Profile

Dependency Diagram

graph TD
  f5cc9b75_d630_dfc5_77e6_726986e86c3b["NormalizedHotChannel"]
  18db4f26_79f1_5b7d_b291_4feeaf95538f["hmr.ts"]
  f5cc9b75_d630_dfc5_77e6_726986e86c3b -->|defined in| 18db4f26_79f1_5b7d_b291_4feeaf95538f
  style f5cc9b75_d630_dfc5_77e6_726986e86c3b fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/vite/src/node/server/hmr.ts lines 129–169

export interface NormalizedHotChannel<Api = any> {
  /**
   * Broadcast events to all clients
   */
  send(payload: HotPayload): void
  /**
   * Send custom event
   */
  send<T extends string>(event: T, payload?: InferCustomEventPayload<T>): void
  /**
   * Handle custom event emitted by `import.meta.hot.send`
   */
  on<T extends string>(
    event: T,
    listener: (
      data: InferCustomEventPayload<T>,
      client: NormalizedHotChannelClient,
    ) => void,
  ): void
  /**
   * @deprecated use `vite:client:connect` event instead
   */
  on(event: 'connection', listener: () => void): void
  /**
   * Unregister event listener
   */
  off(event: string, listener: Function): void
  /** @internal */
  setInvokeHandler(invokeHandlers: InvokeMethods | undefined): void
  handleInvoke(payload: HotPayload): Promise<{ result: any } | { error: any }>
  /**
   * Start listening for messages
   */
  listen(): void
  /**
   * Disconnect all clients, called when server is closed or restarted.
   */
  close(): Promise<unknown> | void

  api?: Api
}

Frequently Asked Questions

What is the NormalizedHotChannel type?
NormalizedHotChannel is a type/interface in the vite codebase, defined in packages/vite/src/node/server/hmr.ts.
Where is NormalizedHotChannel defined?
NormalizedHotChannel is defined in packages/vite/src/node/server/hmr.ts at line 129.

Analyze Your Own Codebase

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

Try Supermodel Free