1
0
Fork 0
mirror of https://github.com/terribleplan/next.js.git synced 2024-01-19 02:48:18 +00:00

Remove console.logs (#402)

This commit is contained in:
Arunoda Susiripala 2016-12-16 08:13:46 +05:30 committed by Naoyuki Kanezawa
parent aa6870a4e6
commit 43b0e6f514
2 changed files with 7 additions and 7 deletions

View file

@ -1,13 +1,14 @@
/* global self */ /* global self */
const CACHE_NAME = 'next-prefetcher-v1' const CACHE_NAME = 'next-prefetcher-v1'
const log = () => {}
self.addEventListener('install', () => { self.addEventListener('install', () => {
console.log('Installing Next Prefetcher') log('Installing Next Prefetcher')
}) })
self.addEventListener('activate', (e) => { self.addEventListener('activate', (e) => {
console.log('Activated Next Prefetcher') log('Activated Next Prefetcher')
e.waitUntil(Promise.all([ e.waitUntil(Promise.all([
resetCache(), resetCache(),
notifyClients() notifyClients()
@ -21,12 +22,12 @@ self.addEventListener('fetch', (e) => {
self.addEventListener('message', (e) => { self.addEventListener('message', (e) => {
switch (e.data.action) { switch (e.data.action) {
case 'ADD_URL': { case 'ADD_URL': {
console.log('CACHING ', e.data.url) log('CACHING ', e.data.url)
sendReply(e, cacheUrl(e.data.url)) sendReply(e, cacheUrl(e.data.url))
break break
} }
case 'RESET': { case 'RESET': {
console.log('RESET') log('RESET')
sendReply(e, resetCache()) sendReply(e, resetCache())
break break
} }
@ -65,10 +66,10 @@ function getResponse (req) {
.then((cache) => cache.match(req)) .then((cache) => cache.match(req))
.then((res) => { .then((res) => {
if (res) { if (res) {
console.log('CACHE HIT: ' + req.url) log('CACHE HIT: ' + req.url)
return res return res
} else { } else {
console.log('CACHE MISS: ' + req.url) log('CACHE MISS: ' + req.url)
return self.fetch(req) return self.fetch(req)
} }
}) })

View file

@ -84,7 +84,6 @@ class Messenger {
this.serviceWorkerState = 'REGISTERED' this.serviceWorkerState = 'REGISTERED'
this.serviceWorkerReadyCallbacks.forEach(cb => cb()) this.serviceWorkerReadyCallbacks.forEach(cb => cb())
this.serviceWorkerReadyCallbacks = [] this.serviceWorkerReadyCallbacks = []
console.log('Next Prefetcher registered')
}) })
} }
} }