Closed frank-dspeed closed 2 years ago
I would vote for yes too.
@frank-dspeed Let's clarify the problem statement here. If it's about supporting fetch
events via addEventListener
, this likely has to go to this repo instead.
@maxshirshin it is about both in general a eventListner for fetch is only like a workaround this issue is about
should we implement a fetch eventListner or should we directly see the whole serviceWorker spec as relevent and i see the whole serviceWorker as relevant even that it is a extra process that does handle the requests.
and that it is register able on a url base
because i think it is in general usefull to promote serviceWorkers webWorkers localstorage indexdb and all this context concepts to the other engines this would allow the engines to run then stuff directly in a secure context and unify the ecosystem
with wasm it got already done and the concepts are 1:1
All Engines should be able to register service workers per url inside the main process and then use fetch that uses the serviceWorker.
the serviceWorker also could implement its own caching logic and so on.
@lucacasonato what is your point about that i found a deno issue where your point was wont fix because no interrest
NodeJS is going same route as they implement Web Streams and Web Crypto we could add as first step Web Workers with context bound fetch and service worker support then again the full fetch spec is relevant and usefull for both sides server and browser.
NEWS! NodeJS just got fetch implemented them self as opt out experimental global so there is no question the minimal fetch api is the one that nodejs already offers it is a none web related implementation and that is fine we should go for Web Context and Web Worker Api as new standards to discuss as part of that we could discusse fetch + serviceWorker api for the WebWorker and WebContext Apis
This is a demonstration how to mock the fetch api via service workers registered on url level we should have the ability in all web compatible environments? I would vote for yes