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
  bb9fa80c_9fff_e8c5_332c_e3cfefd6515f["constructor()"]
  3d417805_fdc5_389c_85fe_d5ccc2aa023a["pushBySize()"]
  bb9fa80c_9fff_e8c5_332c_e3cfefd6515f -->|calls| 3d417805_fdc5_389c_85fe_d5ccc2aa023a
  06fee7d4_f38c_cb80_f7c8_47dea21e6cb4["createWriteFunction()"]
  bb9fa80c_9fff_e8c5_332c_e3cfefd6515f -->|calls| 06fee7d4_f38c_cb80_f7c8_47dea21e6cb4
  style bb9fa80c_9fff_e8c5_332c_e3cfefd6515f 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