constructor()

in conversational-webgpu/src/play-worklet.js [3:19]


    constructor() {
      super();
      this.bufferQueue = [];
      this.currentChunkOffset = 0;
      this.hadData = false;

      this.port.onmessage = (event) => {
        const data = event.data;
        if (data instanceof Float32Array) {
          this.hadData = true;
          this.bufferQueue.push(data);
        } else if (data === "stop") {
          this.bufferQueue = [];
          this.currentChunkOffset = 0;
        }
      };
    }