Licence
MIT
Version
1.1.0
Deps
2
Size
41 kB
Vulns
0
Weekly
27
@xstd/signal
A Signal implementation based on alien-signals.
Installation
yarn add @xstd/signal
# or
npm install @xstd/signal --saveExample
import { signal, computed, batch } from '@xstd/signal';
const width = signal(10);
const height = signal(5);
const surface = computed(() => width() * height());
effect(() => {
console.log(`surface: ${surface()}`);
});
// logs: surface: 50
batch(() => {
// batch allows to update multiple signals at once
width.set(20);
height.set(10);
});
// logs: surface: 200