(interval) add max interval value

This commit is contained in:
2020-07-15 01:21:51 +02:00
parent 217a678196
commit 5a044cf07a

View File

@@ -3,6 +3,7 @@ import { GetterTree } from 'vuex'
import { State, RootActions } from '@/store' import { State, RootActions } from '@/store'
const MIN_INTERVAL = 0.5 const MIN_INTERVAL = 0.5
const MAX_INTERVAL = 60
export const useInterval = () => { export const useInterval = () => {
const { interval } = useGetters<GetterTree<State, State>>(['interval']) const { interval } = useGetters<GetterTree<State, State>>(['interval'])
@@ -15,7 +16,7 @@ export const useInterval = () => {
} }
const plus = () => { const plus = () => {
setInterval(Math.floor(interval.value + 1)) setInterval(Math.min(Math.floor(interval.value + 1), MAX_INTERVAL))
} }
return { return {