Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

59
Vistas
How to access a method within a async function within a same class in Javascript

I am trying to access MethodA within an async function inside MethodB, which is not accessible. But if i am trying outside async function it is working as expected. Below is the example.

Options tried and not working:

  1. Used this.methodA()
class A{
constructor(){
}

async methodA(){
//Do something here
}

async methodB(){
await methodA(); //methodA is accessible in this line
await browser.getCurrentUrl().then(async function(){
await methodA(); //methodA is NOT accessible in this line
});
}
}

module.exports = new A(); //Using this to make the methods available in other places
about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda