PageSourceSearch

https://www.axismf.com/service-worker.js

js axismf.com collected 2026-09-24 10:09:02 UTC 4,400 bytes, 142 lines download raw bytes

1
2importScripts('https://s3-eu-west-1.amazonaws.com/static.wizrocket.com/js/sw_webpush.js');
3// Service worker for caching static assets
4const CACHE_NAME = 'axis-static-cache-v1';
5
6// High priority assets that should be cached immediately
7const CRITICAL_ASSETS = [
8  '/assets/axis_logo.svg'
9];
10
11// Other assets to cache
12const ASSETS_TO_CACHE = [
13  '/assets/header_slide_image.svg',
14  // Add other assets here
15];
16
17// Install event - precache static assets with different priorities
18self.addEventListener('install', (event) => {
19  event.waitUntil(
20    // First cache critical assets
21    caches.open(CACHE_NAME)
22      .then((cache) => {
23        // Cache critical assets first with high priority
24        return cache.addAll(CRITICAL_ASSETS)
25          .then(() => {
26            // Then cache other assets
27            return cache.addAll(ASSETS_TO_CACHE);
28          });
29      })
30      .then(() => self.skipWaiting())
31  );
32});
33
34// Activate event - clean up old caches
35self.addEventListener('activate', (event) => {
36  const currentCaches = [CACHE_NAME];
37  event.waitUntil(
38    caches.keys().then((cacheNames) => {
39      return cacheNames.filter((cacheName) => !currentCaches.includes(cacheName));
40    }).then((cachesToDelete) => {
41      return Promise.all(cachesToDelete.map((cacheToDelete) => {
42        return caches.delete(cacheToDelete);
43      }));
44    }).then(() => self.clients.claim())
45  );
46});
47
48// Fetch event - serve from cache if available, otherwise fetch from network
49self.addEventListener('fetch', (event) => {
50  // Only cache GET requests
51  if (event.request.method !== 'GET') return;
52  
53  const url = new URL(event.request.url);
54  
55  // Special handling for logo - highest priority
56  if (url.pathname === '/assets/axis_logo.svg') {
57    event.respondWith(
58      caches.match(event.request)
59        .then((cachedResponse) => {
60          // Return cached response if available
61          if (cachedResponse) {
62            return cachedResponse;
63          }
64          
65          // If not in cache, fetch from network and cache
66          return fetch(event.request)
67            .then((response) => {
68              if (!response || response.status !== 200) {
69                return response;
70              }
71              
72              // Clone the response
73              const responseToCache = response.clone();
74              
75              caches.open(CACHE_NAME)
76                .then((cache) => {
77                  cache.put(event.request, responseToCache);
78                });
79              
80              return response;
81            });
82        })
83    );
84    return;
85  }
86  
87  // Check if the request is for other static assets
88  const isStaticAsset = 
89    url.pathname.startsWith('/_next/static/') || 
90    url.pathname.startsWith('/assets/') ||
91    url.pathname.endsWith('.svg') ||
92    url.pathname.endsWith('.png') ||
93    url.pathname.endsWith('.jpg') ||
94    url.pathname.endsWith('.jpeg') ||
95    url.pathname.endsWith('.webp');
96  
97  if (!isStaticAsset) return;
98  
99  event.respondWith(
100    caches.match(event.request).then((cachedResponse) => {
101      if (cachedResponse) {
102        // Return cached response
103        return cachedResponse;
104      }
105      
106      // Fetch from network and cache
107      return fetch(event.request).then((response) => {
108        // Don't cache non-successful responses
109        if (!response || response.status !== 200 || response.type !== 'basic') {
110          return response;
111        }
112        
113        // Clone the response as it can only be consumed once
114        const responseToCache = response.clone();
115        
116        caches.open(CACHE_NAME).then((cache) => {
117          cache.put(event.request, responseToCache);
118        });
119        
120        return response;
121      });
122    })
123  );
124}); 
125
126var version = ' 2.4';
127var amp_version = ' 2.4';
128var NOTIFYVISITORS_BRAIND_ID = '8108';
129var _nvClientConfig = {
130    auth: {
131        bid: '8108',
132        bid_e: '7D7FC9FC266FB64B7DF99E43830DE2F1',
133        t: "420"
134    },
135    data: {},
136    cPubKey: 'BHL1ZO808oYHXmP5F9LPplrzvQSe2EVpInhkDx9qcLeZky6zbgA7b0_vYllE46zah6RPbfNePvXam0QBcA2gX9c',
137}
138
139importScripts('https://cdnp.notifyvisitors.com/js/brand_hosted/amp-push-worker.js');
140importScripts('https://cdnp.notifyvisitors.com/js/brand_hosted/push-worker.js');
141importScripts('https://pushimages.notifyvisitors.com/cache_worker/config-8108.js');
142importScripts('https://cdnp.notifyvisitors.com/js/brand_hosted/cache-worker.js');

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.