Home / Function/ constructor() — vue Function Reference

constructor() — vue Function Reference

Architecture documentation for the constructor() function in render-stream.ts from the vue codebase.

Entity Profile

Dependency Diagram

graph TD
  ac9d0fc5_91e9_7ef4_b40f_5953b63312fa["constructor()"]
  5f3e77fd_2395_2037_8fe2_ddb0a0a503a8["RenderStream"]
  ac9d0fc5_91e9_7ef4_b40f_5953b63312fa -->|defined in| 5f3e77fd_2395_2037_8fe2_ddb0a0a503a8
  ef9263a5_4bc9_37dd_6172_60f913bb3926["pushBySize()"]
  ac9d0fc5_91e9_7ef4_b40f_5953b63312fa -->|calls| ef9263a5_4bc9_37dd_6172_60f913bb3926
  5086a0f6_8276_ebf4_9891_182f4be074f2["createWriteFunction()"]
  ac9d0fc5_91e9_7ef4_b40f_5953b63312fa -->|calls| 5086a0f6_8276_ebf4_9891_182f4be074f2
  style ac9d0fc5_91e9_7ef4_b40f_5953b63312fa fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/server-renderer/src/render-stream.ts lines 26–55

  constructor(render: Function) {
    super()
    this.buffer = ''
    //@ts-expect-error
    this.render = render
    this.expectedSize = 0

    this.write = createWriteFunction(
      (text, next) => {
        const n = this.expectedSize
        this.buffer += text
        if (this.buffer.length >= n) {
          this.next = next
          this.pushBySize(n)
          return true // we will decide when to call next
        }
        return false
      },
      err => {
        this.emit('error', err)
      }
    )

    this.end = () => {
      this.emit('beforeEnd')
      // the rendering is finished; we should push out the last of the buffer.
      this.done = true
      this.push(this.buffer)
    }
  }

Subdomains

Frequently Asked Questions

What does constructor() do?
constructor() is a function in the vue codebase, defined in packages/server-renderer/src/render-stream.ts.
Where is constructor() defined?
constructor() is defined in packages/server-renderer/src/render-stream.ts at line 26.
What does constructor() call?
constructor() calls 2 function(s): createWriteFunction, pushBySize.

Analyze Your Own Codebase

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

Try Supermodel Free