AGENGA:
- Một vài lưu ý chung
- Ôn tập kiến thức JS/ReactJS
- Cày thuật toán, giải thuật
- Tìm hiểu về công ty mà mình xin ứng tuyển
import { computed, ref } from "vue"; | |
import { ComputedGetter, pauseTracking, resetTracking } from "@vue/reactivity"; | |
// if no version, not work for objects/arrays... | |
export function cheapComputed<T, K = T>(getValue: ComputedGetter<T>, getVersion?: ComputedGetter<K>) { | |
const value = computed(getValue); | |
const version = getVersion ? computed(getVersion) : value; | |
const lastValue = ref<T>(); | |
const lastVersion = ref<K>(); | |
const changed = computed(() => version.value !== lastVersion.value); |
FWIW: I (@rondy) am not the creator of the content shared here, which is an excerpt from Edmond Lau's book. I simply copied and pasted it from another location and saved it as a personal note, before it gained popularity on news.ycombinator.com. Unfortunately, I cannot recall the exact origin of the original source, nor was I able to find the author's name, so I am can't provide the appropriate credits.
TL;DR* Here's what the license entails:
1. Anyone can copy, modify and distribute this software.
2. You have to include the license and copyright notice with each and every distribution.
3. You can use this software privately.
4. You can use this software for commercial purposes.
5. If you dare build your business solely from this code, you risk open-sourcing the whole code base.