Service workers

Dave <[email protected]>
Newsgroups gmane.comp.lang.smalltalk.squeak.seaside
Message-ID <[email protected]>
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
_______________________________________________
seaside mailing list
[email protected]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.