UNPKG

@liveblocks/react-ui

Version:

A set of React pre-built components for the Liveblocks products. Liveblocks is the all-in-one toolkit to build collaborative products like Figma, Notion, and more.

25 lines (21 loc) 596 B
'use strict'; var react = require('react'); function subscribe(callback) { window.addEventListener("blur", callback); window.addEventListener("focus", callback); return () => { window.removeEventListener("blur", callback); window.removeEventListener("focus", callback); }; } function getSnapshot() { return document.hasFocus(); } function getServerSnapshot() { return true; } function useWindowFocus() { return react.useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot); } exports.useWindowFocus = useWindowFocus; //# sourceMappingURL=use-window-focus.cjs.map