chore(docs): use promise.all to fetch counters
Signed-off-by: braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
@@ -3,9 +3,9 @@ import { $fetch } from 'ohmyfetch'
|
|||||||
import Star from '~icons/carbon/star'
|
import Star from '~icons/carbon/star'
|
||||||
import Download from '~icons/carbon/download'
|
import Download from '~icons/carbon/download'
|
||||||
|
|
||||||
const starGazersCount = ref(0)
|
const starGazersCount = ref(1000)
|
||||||
|
|
||||||
const downloadCount = ref(0)
|
const downloadCount = ref(10000)
|
||||||
|
|
||||||
const starGazersCountTransitioned = useTransition(starGazersCount, {
|
const starGazersCountTransitioned = useTransition(starGazersCount, {
|
||||||
duration: 1000,
|
duration: 1000,
|
||||||
@@ -21,13 +21,14 @@ const downloadCountTransitioned = useTransition(downloadCount, {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
$fetch('https://api.github.com/repos/bcakmakoglu/vue-flow?page=$i&per_page=100').then((data) => {
|
Promise.all([
|
||||||
starGazersCount.value = data.stargazers_count
|
$fetch('https://api.github.com/repos/bcakmakoglu/vue-flow?page=$i&per_page=100').then((data) => {
|
||||||
})
|
starGazersCount.value = data.stargazers_count
|
||||||
|
}),
|
||||||
$fetch('https://api.npmjs.org/downloads/point/last-month/@vue-flow/core').then((data) => {
|
$fetch('https://api.npmjs.org/downloads/point/last-month/@vue-flow/core').then((data) => {
|
||||||
downloadCount.value = data.downloads
|
downloadCount.value = data.downloads
|
||||||
})
|
}),
|
||||||
|
])
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import type { UseDragEvent } from './useDrag'
|
|||||||
export function useGetPointerPosition() {
|
export function useGetPointerPosition() {
|
||||||
const { viewport, snapGrid, snapToGrid } = useVueFlow()
|
const { viewport, snapGrid, snapToGrid } = useVueFlow()
|
||||||
|
|
||||||
// returns the pointer position projected to the RF coordinate system
|
// returns the pointer position projected to the VF coordinate system
|
||||||
return ({ sourceEvent }: UseDragEvent) => {
|
return ({ sourceEvent }: UseDragEvent) => {
|
||||||
const x = sourceEvent.touches ? sourceEvent.touches[0].clientX : sourceEvent.clientX
|
const x = sourceEvent.touches ? sourceEvent.touches[0].clientX : sourceEvent.clientX
|
||||||
const y = sourceEvent.touches ? sourceEvent.touches[0].clientY : sourceEvent.clientY
|
const y = sourceEvent.touches ? sourceEvent.touches[0].clientY : sourceEvent.clientY
|
||||||
|
|||||||
Reference in New Issue
Block a user