title: How to fetch data from firebase for PWA
body: <p>I want to create a PWA in which i am getting data from firebase. Once the page is loaded ADS( in form of objects ) are retrieved from firebase and then displayed. What i want is that once page is loaded if user has lost the connection or is offline, the cache stores all objects that are once loaded at time user was having connection and made them available for offline use i.e without connection to internet.</p>
  
  <p><a href="https://drive.google.com/file/d/1lfAqEbOTRU6JcsQI9nj4RtsWdLP4Hxve/view?usp=sharing" rel="nofollow noreferrer">Link to Download JSON FILE of firebase data</a></p>
  
  <p>and here is the code i am using in service worker</p>
  
  <pre><code>var cacheName = 'test me';
  const filesToCache = [
  './',
  'home.html',
  'details.html',
  '/css/main.css',
  '/css/home.css',
  '/images/nokia.png',
  '/js/app.js',
  '/js/main.js',
  '/js/home.js'
   ];   
  
  self.addEventListener('install', (event) =&gt; {
  event.waitUntil(
      caches.open('v1')
          .then(res =&gt; {
              console.log('wait.........!')
              return res.addAll(filesToCache);
          })
  );
  console.log('installed');
  });
  
  self.addEventListener('activate', (event) =&gt; {
  console.log('activated');
  });
  </code></pre>