Cambiado el funcionamiento de Workbox.

master
Fernando 2019-05-10 15:13:45 -05:00
parent a1449e8ece
commit 626155b71f
1 changed files with 1 additions and 9 deletions

View File

@ -8,7 +8,7 @@ import { register } from 'register-service-worker'
* Privada: 6dOp0WChG-fLFSo9hRnMUn5S1BVBm3KhK9r0m4L-GoA * Privada: 6dOp0WChG-fLFSo9hRnMUn5S1BVBm3KhK9r0m4L-GoA
* */ * */
if (process.env.NODE_ENV === 'production') { if (process.env.NODE_ENV === 'production' || true) {
register(`${process.env.BASE_URL}service-worker.js`, { register(`${process.env.BASE_URL}service-worker.js`, {
ready() { ready() {
console.log( console.log(
@ -18,14 +18,6 @@ if (process.env.NODE_ENV === 'production') {
}, },
registered(registration) { registered(registration) {
console.log('Se ha registrado el Service worker.'); console.log('Se ha registrado el Service worker.');
self.addEventListener("push", e => {
const data = e.data.json();
console.log("Recibi un push :D");
registration.showNotification(data.title, {
body: "Notificacion de prueba",
icon: "http://image.ibb.co/frYOFd/tmlogo.png"
});
});
}, },
cached() { cached() {
console.log('Se ha cacheado el contenido para su uso sin internet.') console.log('Se ha cacheado el contenido para su uso sin internet.')