|
|
|
@ -1,10 +1,11 @@ |
|
|
|
import { ref, nextTick } from 'vue' |
|
|
|
import { ref, nextTick, watch } from 'vue' |
|
|
|
|
|
|
|
export const useLogout = () => { |
|
|
|
const logout = ref(false) |
|
|
|
const clickedNumberTotal = ref(0) |
|
|
|
|
|
|
|
const timer = ref() |
|
|
|
const MAX_NUMBER = 10 |
|
|
|
const DELAY_TIME = 10000 |
|
|
|
const SAFE_COORDINATES = 200 |
|
|
|
|
|
|
|
function resetClickNumber() { |
|
|
|
@ -35,5 +36,15 @@ export const useLogout = () => { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
watch(clickedNumberTotal, newVal => { |
|
|
|
clearTimeout(timer.value) |
|
|
|
timer.value = setTimeout(() => { |
|
|
|
if (newVal !== 0) { |
|
|
|
clearTimeout(timer.value) |
|
|
|
resetClickNumber() |
|
|
|
} |
|
|
|
}, DELAY_TIME) |
|
|
|
}) |
|
|
|
|
|
|
|
return { resetClickNumber, addTotalClick, setLogout, logout } |
|
|
|
} |
|
|
|
|