Closed demersus closed 7 years ago
It does not.
Could you explain a bit more about how you see sw-toolbox
interacting with PATCH
requests? It doesn't seem like one of the runtime caching strategies would be particularly appropriate for use with a PATCH
.
I'm building an app that needs to run offline and place requests into a queue while a connection is not available. Some of these requests will be patch requests because the api is JSONAPI compliant. The goal is to queue the requests into indexeddb and replay them once a connection is available.
sw-toolbox
is good for implementing runtime caching strategies, but doesn't have any support for queueing and replaying failed requests.
There's nothing stopping you from mixing and matching your usage of sw-toolbox
along with your own fetch
handlers that implement custom behavior like what you describe. Just make sure that your fetch
handler is added before sw-toolbox
's routes have a chance to match a request. Inside your fetch
handler, only call event.respondWith()
if you're sure it's one of the requests you want to handle. So, something like:
self.addEventListener('fetch', event => {
if (event.request.method === 'PATCH') {
event.respondWith(
// Your logic goes here.
);
}
});
// Use sw-toolbox to handle other runtime strategies here.
Thanks
Does this library support PATCH? router.patch() is undefined.