Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
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.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.