Auto-reload app every 24h when inactive

This commit is contained in:
Tom Moor
2023-03-29 22:01:45 -04:00
parent f8a6a4b840
commit 381d640719
4 changed files with 70 additions and 1 deletions

View File

@@ -1,4 +1,5 @@
import * as React from "react";
import { Minute } from "@shared/utils/time";
const activityEvents = [
"click",
@@ -18,7 +19,7 @@ const activityEvents = [
* @param {number} timeToIdle
* @returns boolean if the user is idle
*/
export default function useIdle(timeToIdle: number = 3 * 60 * 1000) {
export default function useIdle(timeToIdle: number = 3 * Minute) {
const [isIdle, setIsIdle] = React.useState(false);
const timeout = React.useRef<ReturnType<typeof setTimeout>>();