add vibrate

This commit is contained in:
2023-12-07 22:43:28 +01:00
parent 3da72b1fb3
commit c08b4cc281

View File

@@ -77,6 +77,10 @@ const recalc = () => {
calcStdev(); calcStdev();
}; };
const vibrate = () => {
navigator?.vibrate([30,20,20]);
};
const format = (price, precision = 2, split = false) => { const format = (price, precision = 2, split = false) => {
const num = (price ?? 0); const num = (price ?? 0);
const str = (Number.isNaN(num) ? 0 : num).toFixed(precision); const str = (Number.isNaN(num) ? 0 : num).toFixed(precision);
@@ -119,7 +123,7 @@ onMounted(() => {
</script> </script>
<template> <template>
<div class="box" @click="showSources = !showSources"> <div class="box" @click="showSources = !showSources; vibrate()">
<p class="average"><span class="nobr">1 BTC</span> = <span class="nobr">{{ format(average, 0, true) }} USD</span></p> <p class="average"><span class="nobr">1 BTC</span> = <span class="nobr">{{ format(average, 0, true) }} USD</span></p>
<Transition> <Transition>
<div v-show="showSources" ref="dataSourcesEl"> <div v-show="showSources" ref="dataSourcesEl">