v-dollar
v0.1.0
Published
jQuery-like Vue Reactivity API
Downloads
12
Readme
v-dollar
jQuery-like Vue Reactivity API well-typed!
npm i v-dollar
ref
=> $
computed
=> $
watch
=> $
unref
=> $
set
=> $
You are welcome.
Usages
with v-dollar
import { $ } from 'v-dollar'
const counter = $(0)
const doubled = $(() => $(counter) * 2)
const reset = () => $(counter, 0)
const double = () => $(counter, doubled)
const inc = () => counter.value += 1
$(counter, (value) => console.log(value), { flush: 'post' })
w/o v-dollar
import { ref, computed, unref, watch } from 'vue'
const counter = ref(0)
const doubled = computed(() => counter.value * 2)
const reset = () => counter.value = 0
const double = () => counter.value = unref(doubled)
const inc = () => counter.value += 1
watch(counter, (value) => console.log(value), { flush: 'post' })
Why?
FUN.
It's just a toy, don't take it seriously. But yeah, you can use it in prod if you like :p
License
MIT