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

306
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
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