Although this isn't a problem in other languages, because of semicolon insertion, there could be problems if you don't place the bracket on the opening line:
// no:
function()
{
"use strict"; | |
// Listen to fetch events | |
self.addEventListener('fetch', function(event) { | |
// Check if the image is a jpeg | |
if (/\.jpg$|.png$/.test(event.request.url)) { | |
// Inspect the accept header for WebP support | |
var supportsWebp = false; |