jQuery-like Vue Reactivity API , it's well-typed!
ref
=>$
computed
=>$
watch
=>$
unref
=>$
set
=>$
You are welcome.
withv-dollar
import{$}from'v-dollar'constcounter=$(0)constdoubled=$(()=>$(counter)*2)constreset=()=>$(counter,0)constdouble=()=>$(counter,doubled)$(counter,(value)=>console.log(value),{flush:'post'})
w/ov-dollar
import{ref,computed,unref,watch}from'vue'constcounter=ref(0)constdoubled=computed(()=>counter.value*2)constreset=()=>counter.value=0constdouble=()=>counter.value=unref(doubled)watch(counter,(value)=>console.log(value),{flush:'post'})
Or if you prefer this 😈:
import{$as_}from'v-dollar'constcounter=_(0)constdoubled=_(()=>_(counter)*2)constreset=()=>_(counter,0)constdouble=()=>_(counter,doubled)_(counter,(value)=>console.log(value),{flush:'post'})
FUN.
Don't take it seriously, it's just a toy. But yeah, you can use it in prod if you like, we have nearly 100% test coverage :p
MIT