mirror of
https://github.com/CorentinTh/it-tools.git
synced 2025-05-06 06:17:11 -04:00
🔧:build SSR dist and deploy
This commit is contained in:
parent
76c26901d7
commit
c59ad6aedb
465 changed files with 214127 additions and 2 deletions
37
dist/server/chunks/chunk-cc665c88.js
vendored
Normal file
37
dist/server/chunks/chunk-cc665c88.js
vendored
Normal file
|
@ -0,0 +1,37 @@
|
|||
import { watchThrottled, computedAsync } from '@vueuse/core';
|
||||
import { ref, watch, computed } from 'vue';
|
||||
|
||||
function computedRefreshable(getter, { throttle } = {}) {
|
||||
const dirty = ref(true);
|
||||
let value;
|
||||
const update = () => dirty.value = true;
|
||||
if (throttle) {
|
||||
watchThrottled(getter, update, { throttle });
|
||||
} else {
|
||||
watch(getter, update);
|
||||
}
|
||||
const computedValue = computed(() => {
|
||||
if (dirty.value) {
|
||||
value = getter();
|
||||
dirty.value = false;
|
||||
}
|
||||
return value;
|
||||
});
|
||||
return [computedValue, update];
|
||||
}
|
||||
function computedRefreshableAsync(getter, defaultValue) {
|
||||
const dirty = ref(true);
|
||||
let value;
|
||||
const update = () => dirty.value = true;
|
||||
watch(getter, update);
|
||||
const computedValue = computedAsync(async () => {
|
||||
if (dirty.value) {
|
||||
value = await getter();
|
||||
dirty.value = false;
|
||||
}
|
||||
return value;
|
||||
}, defaultValue);
|
||||
return [computedValue, update];
|
||||
}
|
||||
|
||||
export { computedRefreshableAsync as a, computedRefreshable as c };
|
Loading…
Add table
Add a link
Reference in a new issue