Skip to content

Latest commit

 

History

History
69 lines (44 loc) · 1.18 KB

README.md

File metadata and controls

69 lines (44 loc) · 1.18 KB

v-dollar

jQuery-like Vue Reactivity API , it's 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)

$(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)

watch(counter, (value) => console.log(value), { flush: 'post' })

Or if you prefer this 😈:

import { $ as _ } from 'v-dollar'

const counter = _(0)
const doubled = _(() => _(counter) * 2)

const reset = () => _(counter, 0)
const double = () => _(counter, doubled)

_(counter, (value) => console.log(value), { flush: 'post' })

Why?

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

License

MIT