[Seaside] Service workers

Dave lasmiste at gmail.com
Thu Jul 25 14:29:26 UTC 2019


Hi guys!!

I'm playing with Seaside-REST to implement a PWA
(https://en.wikipedia.org/wiki/Progressive_web_applications). I don't really
know if it is feasible, but I try :-)

The first issue I'm facing is the serviceworker, it seems it does not listen
for fetch requests and I'm guessing because Seaside or Zinc are doing
something under the hood.

This is my code to register the service worker

mainJs
	<get>
	<produces: 'application/javascript'>
	^ 'window.onload = () => {
  "use strict";

  if ("serviceWorker" in navigator) {
   
*navigator.serviceWorker.register("MyApp/swJs")*.then(function(registration)
{
    console.log("Service Worker registered with scope:",
registration.scope);
  }).catch(function(err) {
    console.log("Service Worker registration failed:", err);
  });
  }
}'


And this is the code of the serviceworker

swJs
	<get>	
	<produces: 'application/javascript'>
	^ '/* Serve cached content when offline */
*self.addEventListener("fetch",* function(e) {
  console.log("Fetch request for:", e.request.url);
});'

The serviceworker is successfully registered but I'm expecting a log entry
every time I point to an url on my domain, unfortunately that doesn't
happen.

I'm mimicking the code of this example
https://medium.com/james-johnson/a-simple-progressive-web-app-tutorial-f9708e5f2605
even if I'm trying to further simplifying it

Can you help me, please?
Dave



--
Sent from: http://forum.world.st/Seaside-General-f86180.html


More information about the seaside mailing list