Home / Class/ ThrottledWritable Class — react Architecture

ThrottledWritable Class — react Architecture

Architecture documentation for the ThrottledWritable class in render.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  0a4971ea_f012_2c21_9150_9c1b5294fa5b["ThrottledWritable"]
  da0e9089_1e9e_0728_86ae_6672c71000c6["render.js"]
  0a4971ea_f012_2c21_9150_9c1b5294fa5b -->|defined in| da0e9089_1e9e_0728_86ae_6672c71000c6
  7e46d3de_4079_6fb0_7b33_8f0c0a077f51["constructor()"]
  0a4971ea_f012_2c21_9150_9c1b5294fa5b -->|method| 7e46d3de_4079_6fb0_7b33_8f0c0a077f51
  6e570bfe_e692_6e1a_35bd_5b6080d36aed["_write()"]
  0a4971ea_f012_2c21_9150_9c1b5294fa5b -->|method| 6e570bfe_e692_6e1a_35bd_5b6080d36aed
  b998a47e_bf0b_8351_df33_b911d1deb0b4["_final()"]
  0a4971ea_f012_2c21_9150_9c1b5294fa5b -->|method| b998a47e_bf0b_8351_df33_b911d1deb0b4

Relationship Graph

Source Code

fixtures/ssr/server/render.js lines 18–45

class ThrottledWritable extends Writable {
  constructor(destination) {
    super();
    this.destination = destination;
    this.delay = 10;
  }

  _write(chunk, encoding, callback) {
    let o = 0;
    const write = () => {
      this.destination.write(chunk.slice(o, o + 100), encoding, x => {
        o += 100;
        if (o < chunk.length) {
          setTimeout(write, this.delay);
        } else {
          callback(x);
        }
      });
    };
    setTimeout(write, this.delay);
  }

  _final(callback) {
    setTimeout(() => {
      this.destination.end(callback);
    }, this.delay);
  }
}

Domain

Frequently Asked Questions

What is the ThrottledWritable class?
ThrottledWritable is a class in the react codebase, defined in fixtures/ssr/server/render.js.
Where is ThrottledWritable defined?
ThrottledWritable is defined in fixtures/ssr/server/render.js at line 18.

Analyze Your Own Codebase

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

Try Supermodel Free