Web Notifications API ."> Web Notifications API .">

Notificación web a nivel de sistema personalizable con vanilla JavaScript-Screamer. JS

Tiempo de ejecución: 30 minutos. Empezar

Autor: willianjusten
Views Total: 2,536
Sitio oficial: Ir a la web
Actualizado: August 3, 2018
Licencia: MIT

Vista prévia

Notificación web a nivel de sistema personalizable con vanilla JavaScript-Screamer. JS

Descripción

Screamer. JS es una biblioteca de JavaScript ligera Vanilla que trae sus notificaciones web al nivel del sistema usando < a href = "https://www.w3.org/TR/notifications/" target = "_ blank" rel = "noopener" > Web Notifications API .

¿Cómo funciona?

Incluya el archivo JavaScript Screamer. js en cualquier lugar de su página web.

<script src="screamer.js"></script>

Cree un botón para alternar la notificación Web.

<button id="demo" title="Press me">Click me</button>

Cree una nueva instancia de Screamer.

var options = {


// options here
};

var scream = new Screamer(options);

Enlazar el evento click al botón disparador y mostrar la notificación Web usando métodos Scream. Notify () .

var button = document.querySelector('#demo');
button.addEventListener('click', function(){

scream.notify();
});

Todas las opciones de configuración.

'title': 'Notification title',
'body': 'Notification message',
'icon': 'icon_success.png', // notification icon
'fade': 1000, // fade animation speed
'timeout': 2000, // timeout in ms

Más métodos.

// test for Web Notifications API browser support.
Screamer.verifySupport();

// Verify if permission exists, if not, request a permission and verify if granted.
Screamer.checkPermission();

Funciones de devolución de llamada disponibles.

var scream = new Screamer({


before: function(){},


after: function(){}
});

Registro de cambios

08/03/2018

  • Agregar antes y después de devoluciones de llamada

Te puede interesar: