Security News
RubyGems.org Adds New Maintainer Role
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
workbox-sw
Advanced tools
A service worker library to make managing fetch requests and caching as easy as possible.
The workbox-sw npm package is a library that simplifies service worker creation and management, making it easier to build robust, offline-first web applications. It provides a set of tools to cache assets and other resources, handle background sync, and manage runtime caching strategies.
Precaching
This feature allows you to specify a list of URLs and their corresponding revision details to be precached when the service worker is installed. This is useful for ensuring that your app's core resources are cached and available offline.
import { precacheAndRoute } from 'workbox-precaching';
precacheAndRoute(self.__WB_MANIFEST);
Runtime Caching
Runtime caching enables you to use various caching strategies for different types of requests. This example uses the NetworkFirst strategy, which tries to fetch the latest content from the network, but falls back to the cache if the network is unavailable.
import { registerRoute } from 'workbox-routing';
import { NetworkFirst } from 'workbox-strategies';
registerRoute(
({request}) => request.destination === 'document',
new NetworkFirst()
);
Background Sync
Background Sync allows you to defer actions until a stable network connection is detected. This is particularly useful for ensuring that user actions, like posting comments, are not lost when the app is offline.
import { BackgroundSyncPlugin } from 'workbox-background-sync';
const bgSyncPlugin = new BackgroundSyncPlugin('myQueueName', {
maxRetentionTime: 24 * 60 // Retry for max of 24 Hours
});
sw-toolbox is a predecessor of workbox-sw, offering similar features like dynamic caching and offline support. However, workbox-sw provides a more modular and flexible approach, with better support for modern web standards.
sw-precache is another predecessor to workbox-sw that focuses on static resource caching. Unlike workbox-sw, it does not offer extensive runtime caching strategies or background sync capabilities.
A service worker library to make managing fetch requests and caching as easy as possible.
npm install --save-dev workbox-sw
Browse sample source code in the demo directory.
You can find documentation for this module here.
FAQs
This module makes it easy to get started with the Workbox service worker libraries.
The npm package workbox-sw receives a total of 1,628,961 weekly downloads. As such, workbox-sw popularity was classified as popular.
We found that workbox-sw demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 6 open source maintainers collaborating on the project.
Did you know?
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.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.
Security News
Research
Socket's threat research team has detected five malicious npm packages targeting Roblox developers, deploying malware to steal credentials and personal data.