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

300
Vistas
How to wait until navigator.notification.prompt() input has been given

I am using a Cordova app to embed a React app. In a certain point, the user connects to the camera and a notification appears when a QR code is detected. I want that the code execution waits until user has entered his/her answer "Yes/No", but I can't get it to work. Notification prompt message works as expected though.

I need it to pause somehow, as in an async function (like prompt would, for instance). How could I pause the code execution until the user has chosen Yes/No in screen? I guess with some async/await but don't see where... I have tried unsuccessfully so far:

let test = null;
let input2 = null;
notification = navigator.notification.prompt("Do you know this QR code?",
     async function(input) {
     input2 = input;
     test = await NotificationFunction(input, Camera_content);
     console.log(test)
     console.log('input2')
     return [test, input2]
     });

let test2= await notification
console.log(test2)
console.log(notification)
console.log(await test)

Thanks a lot in advance!

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Maybe you can use something like this:

const promise = new Promise((resolve, reject) => {
  navigator.notification.prompt(
    'Do you know this QR code?',
    async function (input) {
      test = await NotificationFunction(input, Camera_content);
      resolve([test, input]);
    },
  );
});

const [test, input] = await promise

Also maybe this can help https://javascript.info/promisify

about 4 years ago · Juan Pablo Isaza Denunciar
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