Forum Discussion

Ya_akovGoldberg's avatar
Ya_akovGoldberg
Qrew Trainee
6 years ago

Service Worker

I am working on implementing changes with Service Workers. I am following the series of posts from Dan Diebolt, Service Worker Travel Logs, and it is making sense. The one part I am stuck on is in the last one; https://community.quickbase.com/quickbase/topics/service-worker-travel-log-day-13, specifically implementing the cheerio.js library. Do I need to bring over every file in the GitHub page, or is there a way to simply reference them all at once?

7 Replies

  • No just import cheerio.js itself. A Service Worker has no access to the DOM so libraries such as jQuery which presupposes a DOM will not work. Cheerio restores that capability to the Service Worker. However, I would think carefully if you really need it as most Service Workers do not need access to the DOM.

    Service Workers are the future. Alas, you have to repeat new concepts a hundred times before enlighten, bleeding edge, avant garde users such as yourself pickup on the innovation.
    • Ya_akovGoldberg's avatar
      Ya_akovGoldberg
      Qrew Trainee
      So I had thought about that and checked that. When I use the import, I get an error in the console: bk64mv5j9?a=dbpage&pagename=cheerio.js:5 Uncaught ReferenceError: require is not defined.
    • Ya_akovGoldberg's avatar
      Ya_akovGoldberg
      Qrew Trainee
      After looking back through my code, I figured out that I had forgotten that as a part of your request on day 12, you specify your own table information, after adjusting it to reference the correct table dbid and apptoken, it now works.