Security News
The Unpaid Backbone of Open Source: Solo Maintainers Face Increasing Security Demands
Solo open source maintainers face burnout and security challenges, with 60% unpaid and 60% considering quitting.
anotherstatemanager
Advanced tools
Very flexible, performant, simple state management for managing a lot of rapid changes and various scenarios. Great for low overhead event management of game inputs and data streams.
npm i anotherstatemanager
Simple state manager.
Set key responses to have functions fire when keyed values change. Can be set to run on a timer interval, or only fire when triggered, or you can stack sequential updates to fire per frame (e.g. summing key inputs). Very flexible, dependent on our ObjectListener.js
Example:
import {StateManager} from 'anotherstatemanager'
let state = new StateManager();
let sub = state.subscribe('x',(newx) => {console.log(newx);});
state.subscribe(key,onchange);
state.subscribeTrigger(key,onchange);
state.subsribeSequential(key,onchange);
state.unsubsribe(sub);
state.unsubscribeTrigger(sub);
state.unsubscribeSequential(sub);
state.subscribeOnce(key,onchange);
state.subscribeTriggerOnce(key,onchange);
state.subscribeSequentialOnce(key,onchange);
//...
state.setState({x:3});
state.setState({...keys:values});
There are 3 different state systems stacked on top of each other. You can set up the state manager to only use triggers (by setting defaultKeyEventLoop to false on init) which run exclusively on setState, avoiding needless timer checks. Individual subscriptions can be set to not run the checkers too, you can get pretty complicated but it's easier to keep different states with different schedules.
The rest of the functions are pretty much internal use only.
You can directly mutate state.data.x etc. which will still update the timer-check data, but will miss triggers.
The crux of this relies on a heavily modified JSON.stringifyFast function which lets you monitor large objects and arrays with a fast, shallow deep-copy system. We hammered it out to deal with giant objects or arrays etc. as lazily as possible, just watch your performance if you're also gonna be that lazy as it has a few catches.
By Joshua Brewster and Garrett Flynn License: AGPL v3.0
FAQs
Very flexible, performant, simple state management for managing a lot of rapid changes and various scenarios. Great for low overhead event management of game inputs and data streams.
The npm package anotherstatemanager receives a total of 5 weekly downloads. As such, anotherstatemanager popularity was classified as not popular.
We found that anotherstatemanager 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
Solo open source maintainers face burnout and security challenges, with 60% unpaid and 60% considering quitting.
Security News
License exceptions modify the terms of open source licenses, impacting how software can be used, modified, and distributed. Developers should be aware of the legal implications of these exceptions.
Security News
A developer is accusing Tencent of violating the GPL by modifying a Python utility and changing its license to BSD, highlighting the importance of copyleft compliance.