
Security News
Insecure Agents Podcast: Certified Patches, Supply Chain Security, and AI Agents
Socket CEO Feross Aboukhadijeh joins Insecure Agents to discuss CVE remediation and why supply chain attacks require a different security approach.
storeon-localstorage2
Advanced tools
A fork of the original @storeon/localstorage, supports glob-pattern
This is a fork version of the original package, adding glob-pattern support.
Tiny module for Storeon to store and sync state to localStorage. It restores state from localStorage during page loading and saves state on every change.
It is an 8kb module (it uses Size Limit to control the size) with only one dependency (picomatch).
It is significantly bigger than the original version (173 bytes), but it is more powerful.
npm install storeon-localstorage2
If you want to store and sync state to localStorage you should import the persistState from storeon-localstorage2 and add this module to createStore.
import createStore from 'storeon'
import persistState from 'storeon-localstorage2'
let name = store => {
store.on('@init', () => ({ name: '' }))
store.on('save', (state, name) => ({ name: name }))
}
const store = createStore([name, persistState(['name'])])
Feel free to use glob patterns in the paths.
import createStore from 'storeon'
import persistState from 'storeon-localstorage2'
let name = store => {
store.on('@init', () => ({ 'save-name': '' }))
store.on('save', (state, name) => ({ 'save-name': name }))
}
const store = createStore([name, persistState(['save-*'])])
Here you can see that the form ask user the name and after that show this name.
import useStoreon from 'storeon/react'
import StoreContext from 'storeon/react/context'
const Form = () => {
const { dispatch, name } = useStoreon('name')
return (
<React.Fragment>
{name !== '' && <h3>Hello {name}!</h3>}
{name === '' && (
<div>
<label>Name</label>
<input type="text" id="name" />
<br />
<button
onClick={() =>
dispatch('save', document.getElementById('name').value)
}
>
Save
</button>
</div>
)}
</React.Fragment>
)
}
Event after refresh the page the state is updating from localStorage. And user see the greeting message.

type paths = Void | Array<String>
If no pass the paths value then persistState store in local storage all state.
type config.key = String
Default value of config.key is storeon. This key is using to store data in local storage.
MIT
This module based on redux-localstorage.
FAQs
A fork of the original @storeon/localstorage, supports glob-pattern
We found that storeon-localstorage2 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
Socket CEO Feross Aboukhadijeh joins Insecure Agents to discuss CVE remediation and why supply chain attacks require a different security approach.

Security News
Tailwind Labs laid off 75% of its engineering team after revenue dropped 80%, as LLMs redirect traffic away from documentation where developers discover paid products.

Security News
The planned feature introduces a review step before releases go live, following the Shai-Hulud attacks and a rocky migration off classic tokens that disrupted maintainer workflows.