
Company News
Socket Joins New OpenJS Program to Fund Node.js Security Work
Socket is joining the OpenJS Security Stewardship Program to fund Node.js vulnerability research, maintainer remediation, and security releases.
@solid-primitives/trigger
Advanced tools
A set of primitives based on Solid signals, used to trigger computations.
A set of primitives based on Solid signals, used to trigger computations.
createTrigger - Set listeners in reactive computations and then trigger them when you want.createTriggerCache - Creates a cache of triggers that can be used to mark dirty only specific keys.npm install @solid-primitives/trigger
# or
yarn add @solid-primitives/trigger
# or
pnpm add @solid-primitives/trigger
createTriggerSet listeners in reactive computations and then trigger them when you want.
import { createTrigger } from "@solid-primitives/trigger";
const [track, dirty] = createTrigger();
createEffect(() => {
track();
// ...
});
// later
dirty();
createTriggerCacheCreates a cache of triggers that can be used to mark dirty only specific keys.
Cache is a Map or WeakMap depending on the mapConstructor argument. (default: Map)
If mapConstructor is WeakMap then the cache will be weak and the keys will be garbage collected when they are no longer referenced.
Trigger signals added to the cache only when tracked under a computation, and get deleted from the cache when they are no longer tracked.
track and dirty are called with a key so that each tracker will trigger an update only when his individual key would get marked as dirty.
import { createTriggerCache } from "@solid-primitives/trigger";
const map = createTriggerCache<number>();
createEffect(() => {
map.track(1);
// ...
});
// later
map.dirty(1);
// this won't cause an update:
map.dirty(2);
createTriggerCache constructor can take a WeakMap constructor as an argument. This will create a WeakMap of triggers instead of a Map.
const map = createTriggerCache<object>(WeakMap);
const obj = {};
createEffect(() => {
map.track(obj);
// ...
});
// later
map.dirty(obj);
TODO
See CHANGELOG.md
FAQs
A set of primitives based on Solid signals, used to trigger computations.
The npm package @solid-primitives/trigger receives a total of 1,217,472 weekly downloads. As such, @solid-primitives/trigger popularity was classified as popular.
We found that @solid-primitives/trigger demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers collaborating on the project.

Company News
Socket is joining the OpenJS Security Stewardship Program to fund Node.js vulnerability research, maintainer remediation, and security releases.

Security News
Two compromised GitHub Actions were re-enabled with malicious tags intact, exposing thousands of downstream repositories to Mini Shai-Hulud.

Research
/Security News
A malicious Firefox extension fetches its payload after installation to evade detection, steal Google session cookies, and automate account takeover.