✨ (interval) add max interval value
This commit is contained in:
@@ -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 {
|
||||||
|
|||||||
Reference in New Issue
Block a user