♻️ (timer) break into more pieces the hook useTimer

This commit is contained in:
2020-07-04 10:50:58 +02:00
parent b0e28ae209
commit fe674c73df
5 changed files with 150 additions and 110 deletions

View File

@@ -0,0 +1,34 @@
<template>
<div class="chilled-music">
<youtube-video
v-show="false"
src="https://www.youtube-nocookie.com/embed/5qap5aO4i9A"
/>
</div>
</template>
<script lang="ts">
import 'youtube-video-js'
import { defineComponent, onMounted, watchEffect } from '@vue/composition-api'
export default defineComponent({
name: 'ChilledMusic',
props: {
play: {
type: Boolean,
required: true
}
},
setup(props) {
let chilledcow: HTMLVideoElement | null = null
onMounted(() => {
chilledcow = document.querySelector('youtube-video')
})
watchEffect(() => {
props.play ? chilledcow?.play() : chilledcow?.pause()
})
}
})
</script>