mardi 7 novembre 2017

If statement for specific event.request

I have the following code in my service worker index.js to show all the event request urls:

self.addEventListener('fetch', functin(event) {
  console.log(event.request.url);
});

With this all the request url are listed in the console. What i need is a simple if statement to check if the request url ends with .jpg. so far i tried it with if === '.jpg' or variations or with 'image/jpg' but it does not do the trick.

Aucun commentaire:

Enregistrer un commentaire