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
  6c6ba38e_f41f_a474_9808_5ac6799942b2["constructor()"]
  72937d8d_7584_5ce7_99da_5d1f2e14e684["pushBySize()"]
  6c6ba38e_f41f_a474_9808_5ac6799942b2 -->|calls| 72937d8d_7584_5ce7_99da_5d1f2e14e684
  952e7302_eb52_7258_f162_b5e4d278feb0["createWriteFunction()"]
  6c6ba38e_f41f_a474_9808_5ac6799942b2 -->|calls| 952e7302_eb52_7258_f162_b5e4d278feb0
  style 6c6ba38e_f41f_a474_9808_5ac6799942b2 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.
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