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

53
Visualizações
Add Promise-Chain part in reuseable function

I got a bunch of functions which consist of a simple promise-chain which is mostly individual, anyway for all my functions a small block in the promise-chain is the same for all chains.

Example:

function A() {
  DoSomethingA()
    .then(/* specific then block */)
    .then(/* general then block */)
    .then(/* general then block */)
    .then(/* specific then block */)
}

function B() {
  DoSomethingB()
    .then(/* specific then block */)
    .then(/* general then block */)
    .then(/* general then block */)
}

Now I want to have the "general then block" part be reusable variable/function so I can edit it for all functions at once when required. I just miss how I might handle this in the simplest way. Before and after the "general-then-blocks" there might be a undefined amount of "specific then blocks". The "general then blocks" always appear in this given order and always are exactly after each other.

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