1
0
mirror of https://github.com/jaandrle/deka-dom-el synced 2024-11-22 16:55:23 +01:00
deka-dom-el/docs_src/components/examples/signals/intro.js

9 lines
273 B
JavaScript
Raw Normal View History

2023-11-23 18:36:26 +01:00
import { S } from "deka-dom-el/signals";
// α — `signal` represents a reactive value
const signal= S(0);
// β — just reacts on signal changes
S.on(signal, console.log);
// γ — just updates the value
signal(signal()+1);
setInterval(()=> signal(signal()+1), 5000);