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
  ec62e370_b17a_a955_cb10_fe4626afcaf0["constructor()"]
  60ba4fed_c502_859c_60b1_5ab9b57882ca["RenderStream"]
  ec62e370_b17a_a955_cb10_fe4626afcaf0 -->|defined in| 60ba4fed_c502_859c_60b1_5ab9b57882ca
  9142a816_c281_34f1_d187_c42a71e9ebc2["pushBySize()"]
  ec62e370_b17a_a955_cb10_fe4626afcaf0 -->|calls| 9142a816_c281_34f1_d187_c42a71e9ebc2
  208f6731_ceac_754f_49df_75211ecf996c["createWriteFunction()"]
  ec62e370_b17a_a955_cb10_fe4626afcaf0 -->|calls| 208f6731_ceac_754f_49df_75211ecf996c
  style ec62e370_b17a_a955_cb10_fe4626afcaf0 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