Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Añadir notificaciones push #17

Open
AngelGuerra opened this issue Apr 3, 2020 · 1 comment
Open

Añadir notificaciones push #17

AngelGuerra opened this issue Apr 3, 2020 · 1 comment
Labels
mejora New feature or request

Comments

@AngelGuerra
Copy link
Contributor

Viendo que la página es una PWA, se puede aprovechar la API de notificaciones para enviar notificaciones (válgame la redundancia), parece relativamente sencillo, sólo habría que pensar dónde implementar el envío de notificaciones.

// Solicita permiso
Notification.requestPermission(function(status) {
    console.log('Notification permission status:', status);
});

// Envía notificaciones
function displayNotification() {
  if (Notification.permission == 'granted') {
    navigator.serviceWorker.getRegistration().then(function(reg) {
      reg.showNotification('Hello world!');
    });
  }
}

Hay un ejemplo completo aquí.

@ardillan ardillan added the mejora New feature or request label Apr 26, 2020
@ardillan
Copy link
Owner

La verdad es que es buena idea. La aplicación venía por defecto con este paquete y esta pequeña configuración.

Hasta el momento no he hecho hincapié en ello, pero sería muy interesante aprovechar todas las funcionalidades que brinda una PWA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mejora New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants