Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

127
Visualizações
How do I control the time the settimeout takes to load an array buffer completely?

enter image description here

I need an array buffer(that can be used to generate a PDF) that has 137618 bytes. In the exportFcBwaPDF function, when called in component A,the array buffer is loaded completely and has the values it is supposed to have.

public exportFcBwaPDF(pdfObject) {
...
 if (this.isForReporting === true){

      pdfObject.arrayBuffer = pdf.output('arraybuffer');
      console.log('AB OBAB' ,  pdfObject.arrayBuffer);
      console.log('AB FC1' ,  pdf.output('arraybuffer'));
      return pdfObject.arrayBuffer;
    }else {
      pdf.save('FC-BWA.pdf');
      console.log('AB FCBWA 2', pdf.output('arraybuffer'));
      this.currentFcBwaExport.emit({excel: true});
    }

}

generateExternFcBwaPDF() is a function that is supposed to return the said arraybuffer after 15 seconds because some data needs some time to be completely loaded in order to be printed on a PDF. Regarding the 2nd function: everything from the line where ' let fcBwaPdfObject = {arrayBuffer: ''};' is seen is important everything else can be ignored.

 public  generateExternFcBwaPDF(){
    // function (JS object, parameter) ; object = {key:value};setTimeout(function (JS object, parameter),time)
    this.loadData();
    this.getCurrentYear();
    this.loadMandantData();
    this.renderExportTimeStamp();
    this.sortByProperty('nr.');
    this.loadMandantData();
    let fcBwaPdfObject = {arrayBuffer: ''};
    setTimeout(this.exportFcBwaPDF(fcBwaPdfObject), 15000);
    console.log('Generate AB', fcBwaPdfObject.arrayBuffer);
return fcBwaPdfObject.arrayBuffer;
  }

Both the 2 functions have been coded inside component A. .

  const externExp =  new FcBwaExportComponent(this.navService, this.changeColorService, this.userAreaService, this.fcBwaService, this.renderer, this.element, this.document);
   externExp.isForReporting = true;
externExp.generateExternFcBwaPDF();

I call the generateExternFcBwaPDF function inside component B and the array buffer is not what I am looking for. The arraybuffer with 3438 bytes finishes too early. What do I do wrong? Can anyone explain why it doesn't work correctly? enter image description here

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda