You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
698 B
30 lines
698 B
<script lang="ts">
|
|
import { onMount } from "svelte";
|
|
import goalStore, { fpGoalStore } from "../stores/goal";
|
|
import logStore from "../stores/logs";
|
|
import projectStore, { fpProjectStore } from "../stores/project";
|
|
|
|
let lastFocus = new Date();
|
|
|
|
function handleFocus() {
|
|
if (Date.now() - lastFocus.getTime() < 60000) {
|
|
return;
|
|
}
|
|
|
|
lastFocus = new Date();
|
|
|
|
goalStore.markStale();
|
|
fpGoalStore.markStale();
|
|
projectStore.markStale();
|
|
fpProjectStore.markStale();
|
|
logStore.markStale();
|
|
}
|
|
|
|
onMount(() => {
|
|
window.addEventListener("focus", handleFocus);
|
|
|
|
return () => {
|
|
window.removeEventListener("focus", handleFocus);
|
|
}
|
|
})
|
|
</script>
|