
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
@axcraft/external-state
Advanced tools
A lightweight data container allowing for subscription to its updates, e.g. to be shared by multiple independent parts of code
Such containers can be used as state shared across application components with libraries like React. See @axcraft/react-external-state exposing a ready-to-use hook for shared state management.
ExternalState accepts data of any kind.
import { ExternalState } from "@axcraft/external-state";
// With a primitive value
let state1 = new ExternalState(0);
// With a nonprimitive value
let state2 = new ExternalState({ counter: 0 });
The ExternalState value can be read and updated with getValue() and setValue(update). setValue(update) accepts either a new value or a function (value) => nextValue that returns a new state value based on the current state value.
let state = new ExternalState({ counter: 0 });
state.setValue({ counter: 100 });
state.setValue((value) => ({ ...value, counter: value.counter + 1 }));
let value = state.getValue();
console.log(value.counter); // 101
Each time the ExternalState value is updated via setValue(value) the state emits an "update" event allowing for subscriptions:
let unsubscribe = state.on("update", ({ current, previous }) => {
console.log(current, previous);
});
Each subscription returns an unsubscription function. Once it's invoked, the given callback is removed from the ExternalState instance and no longer called when the state is updated.
FAQs
Data container allowing for subscription to its updates
We found that @axcraft/external-state demonstrated a healthy version release cadence and project activity because the last version was released less than 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
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.