mirror of
https://github.com/jaandrle/deka-dom-el
synced 2024-11-25 09:49:36 +01:00
Jan Andrle
cd62782c7b
* ⚡ refact docs to make editing (now renaming observables to signal) easier * ⚡ ⚡ use signal(s) term isntead of observable(s) * ⚡ 🔤 version + typo * 🐛 customElement example (0→S) * 📺 version in package-lock.json
19 lines
406 B
JavaScript
19 lines
406 B
JavaScript
import { S } from "deka-dom-el/signals";
|
|
const signal= S(0, {
|
|
increaseOnlyOdd(add){
|
|
console.info(add);
|
|
if(add%2 === 0) return this.stopPropagation();
|
|
this.value+= add;
|
|
}
|
|
});
|
|
S.on(signal, console.log);
|
|
const oninterval= ()=>
|
|
S.action(signal, "increaseOnlyOdd", Math.floor(Math.random()*100));
|
|
|
|
const interval= 5*1000;
|
|
setTimeout(
|
|
clearInterval,
|
|
10*interval,
|
|
setInterval(oninterval, interval)
|
|
);
|