
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
A simple Flux implementation without any build requirements or dependencies. This is easier to learn, but for real projects you should consider Redux instead!
This library is just an autotroph
module with some properties: dispatch
and other methods are based on the Flux reference dispatcher, and createStore
is a helper function for creating simple stores that will receive dispatched actions.
The output of a call to autotroph.createStore()
is an object that has .subscribe()
, .unsubscribe()
, and .getState()
functions. Subscribe your render function to these stores, and then pass your action objects to autotroph.dispatch()
.
The first argument to autotroph.createStore()
is an object with the initial values of your state variables. This object will be passed into the actionHandler
along with every action
that is dispatched. By default changes are saved by mutating this object, and you are responsible for adding any immutable behavior. You can assign immutable references to any property on initialState
, or make initialState
an array of historical state objects.
The second argument to autotroph.createStore()
is a function that takes the current state and the action object as arguments, and returns true
if the app should re-render. Check the action and either update the state or make a new immutable version in this handler. In most cases this function will return true
, but you can return false
to skip re-rendering.
See test.html for a usage example. This file can be downloaded and run locally in most browsers with no setup.
FAQs
a simple ES5 flux library
The npm package autotroph receives a total of 1 weekly downloads. As such, autotroph popularity was classified as not popular.
We found that autotroph 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
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.