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.
dollar-state
Advanced tools
A simple JS state management library - inspired by Redux and based on Immer
A simple JS state management library - inspired by Redux and based on Immer
Install $tate
by running
npm install dollar-state
Create a store by running createStore
import $tate from 'dollar-state';
const store = $tate.createStore();
createStore
can be invoked with 2 arguments
initialState
, an object to initialize the state withoptions
, an optional object with the following keys
persistenceKey
, a string to be used to persist the store to LocalStorage
on each update (if required)debug
, a flag to enable debug logging on updateState
calls, default: false
To update the state you should call the updateState
function passing a state modifier function
store.updateState(function(currentState) {
currentState.count = 1;
});
To subscribe to state changes you simple set a state listener
const _unsubscribeStore = store.subscribe(function(newState) {
console.log({ newState });
});
N.B: Don't forget to call the returned method when you don't need updates anymore
if (_unsubscribeStore) {
_unsubscribeStore();
}
To reset a store to its initial state
store.resetState();
A demo using jQuery
is available inside the demo
folder.
To run the demo:
npm run dev
dollar-state.min.js
file from dist
to demo
foldercp dist/dollar-state.min.js demo
demo
npm dependenciescd demo
npm install
npm run start
Made with :sparkles: & :heart: by Mattia Panzeri and contributors
If you found this project to be helpful, please consider buying me a coffee.
FAQs
A simple JS state management library - inspired by Redux and based on Immer
The npm package dollar-state receives a total of 0 weekly downloads. As such, dollar-state popularity was classified as not popular.
We found that dollar-state 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
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.