restful-queue

    0.0.1 • Public • Published

    restful-queue

    A queue for service workers which send requests to a restful API

    Basic usage

    Add the following to your service worker to use the queue for all non-GET requests:

    import { queueAndAttemptRequest } from 'restful-queue';
    
    self.addEventListener('fetch', event => {
    	if (event.request.method !== 'GET') {
    		event.respondWith(queueAndAttemptRequest(event.request));
    	} else {
    		... // Handle GET requests here, eg return them from cache
    	}
    });
    

    See also

    Install

    npm i restful-queue

    DownloadsWeekly Downloads

    12

    Version

    0.0.1

    License

    none

    Unpacked Size

    19.1 kB

    Total Files

    5

    Last publish

    Collaborators

    • lucas42