windowFocusStore

Reactively track window focus with window.onfocus and window.onblur events.

Demo

ℹ Tab is unfocused

Usage

<script lang="ts">
import { windowFocusStore } from 'svelte-legos';

const isFocused = windowFocusStore();

// $isFocused changes to true | false on focus | blur.
  
</script>