mirror of
https://github.com/jaandrle/deka-dom-el
synced 2025-07-03 05:02:15 +02:00
⚡ Docs
This commit is contained in:
18
docs/components/examples/signals/actions-demo.js
Normal file
18
docs/components/examples/signals/actions-demo.js
Normal file
@ -0,0 +1,18 @@
|
||||
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)
|
||||
);
|
Reference in New Issue
Block a user