@xstd/signal
v1.1.0
Published
Signal implementation
Readme
@xstd/signal
A Signal implementation based on alien-signals.
📦 Installation
yarn add @xstd/signal
# or
npm install @xstd/signal --save🏭 Example
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📜 Documentation
https://xstd-js.github.io/signal
