🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

workbox-recipes

Package Overview
Dependencies
Maintainers
7
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

workbox-recipes

A service worker helper library to manage common request and caching patterns

7.3.0
latest
Source
npm
Version published
Weekly downloads
3M
-17.71%
Maintainers
7
Weekly downloads
 
Created

What is workbox-recipes?

The workbox-recipes npm package provides pre-configured, common service worker strategies and behaviors for web applications using Workbox. It simplifies the implementation of caching, offline functionality, and other progressive web app (PWA) features.

What are workbox-recipes's main functionalities?

Offline Page

This feature allows you to specify fallback pages or images when the network is unavailable. The code sample shows how to set up offline fallbacks for both pages and images.

import { offlineFallback } from 'workbox-recipes';

offlineFallback({
  pageFallback: '/offline.html',
  imageFallback: '/static/images/offline.jpg'
});

Static Resource Caching

Enables caching for static resources such as CSS and JavaScript files. The code sample demonstrates pre-caching specific URLs on service worker installation.

import { staticResourceCache } from 'workbox-recipes';

staticResourceCache({
  warmupUrls: ['/styles/main.css', '/scripts/main.js']
});

Google Fonts Caching

Provides a simple method to cache Google Fonts used on your web pages, enhancing performance and reducing data usage.

import { googleFontsCache } from 'workbox-recipes';

googleFontsCache();

Other packages similar to workbox-recipes

Keywords

workbox

FAQs

Package last updated on 29 Oct 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts