Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
swr-sync-storage
Advanced tools
Synchronize SWR cache with localStorage or sessionStorage to get offline cache
Readme
Synchronize SWR cache with localStorage or sessionStorage to get offline cache.
Install it
$ yarn add swr-sync-storage
Note: You will need to provide SWR v0.2.0-beta.0 or greater
import { syncWithStorage } from "swr-sync-storage";
syncWithStorage("local");
syncWithStorage("session");
You can also import to already bound versions of local or session storage.
import { syncWithLocalStorage } from "swr-sync-storage";
syncWithLocalStorage();
import { syncWithSessionStorage } from "swr-sync-storage";
syncWithSessionStorage();
All the functions will return a function to stop subscribing for cache changes.
All functions receive a parser
function to let you parse the storage value, the default value is:
function parser(value: string): any {
return value === 'undefined' ? undefined : JSON.parse(value);
}
If your SWR cache could have non-object values such as numbers you could pass a custom parser and control how syncWithStorage
will transform it before adding it to SWR.
FAQs
Synchronize SWR cache with localStorage or sessionStorage to get offline cache
The npm package swr-sync-storage receives a total of 104 weekly downloads. As such, swr-sync-storage popularity was classified as not popular.
We found that swr-sync-storage demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.