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.

19 lines
432 B

  1. <script lang="ts">
  2. import { onMount } from "svelte";
  3. import markStale from "../stores/markStale";
  4. let lastFocus = Date.now();
  5. function handleFocus() {
  6. if ((Date.now() - lastFocus) > 60000) {
  7. markStale("*");
  8. lastFocus = Date.now();
  9. }
  10. }
  11. onMount(() => {
  12. window.addEventListener("focus", handleFocus);
  13. return () => {
  14. window.removeEventListener("focus", handleFocus);
  15. }
  16. })
  17. </script>