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

313
Vistas
Notification with requireInteraction - how to check if displayed?

I show a 'sticky' notification like this:

function show(text) {
  let alreadyOn = false; // ??? how to get this ???
  
  if (!alreadyOn) {
    new Notification(text, {
        requireInteraction : true
    });
  }
}

Notification.requestPermission();
show("first");
setTimeout(() => show("second"), 1000);

(note this just a sample and you need to permit notification the first time it runs and try again)

Is there a way for my code to later determine if this notification is still on or the user already dismissed it ? That is how to determine alreadyOn above ?

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

0

You can add an event handler with Notification.onclose method to do something when the Notification is closed by the user.

Notification.onclose = function () {
  // do something...
}
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