<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[42991],{19081:(e,t,i)=&gt;{(window.__NEXT_P=window.__NEXT_P||[]).push(["/hooks/use-document-visibility",function(){return i(458)}])},458:(e,t,i)=&gt;{"use strict";i.r(t),i.d(t,{default:()=&gt;u});var s=i(31085),n=i(71184),a=i(93065),o=i(14041),d=i(35033);let r={type:"code",code:`
import { Text } from '@mantine/core';
import { useDocumentTitle, useDocumentVisibility } from '@mantine/hooks';

function Demo() {
  const documentState = useDocumentVisibility();
  useDocumentTitle(\`Document is \${documentState}\`);
  return &lt;Text&gt;Switch to another tab to see document title change&lt;/Text&gt;;
}
`,component:function(){let e=function(){let[e,t]=(0,o.useState)("visible");return(0,o.useEffect)(()=&gt;{let e=()=&gt;t(document.visibilityState);return document.addEventListener("visibilitychange",e),()=&gt;document.removeEventListener("visibilitychange",e)},[]),e}();return(0,d.r)(`Document is ${e}`),(0,s.jsx)(a.E,{children:"Switch to another tab to see document title change"})}};var c=i(18675),h=i(20017);let l=(0,c.P)(h.XZ.useDocumentVisibility);function v(e){let t={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,n.R)(),...e.components},{Demo:i}=t;return i||function(e,t){throw Error("Expected "+(t?"component":"object")+" `"+e+"` to be defined: you likely forgot to import, pass, or provide it.")}("Demo",!0),(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(t.h2,{id:"usage",children:"Usage"}),"\n",(0,s.jsxs)(t.p,{children:[(0,s.jsx)(t.code,{children:"use-document-visibility"})," hook returns current ",(0,s.jsx)(t.a,{href:"https://developer.mozilla.org/en-US/docs/Web/API/Document/visibilityState",children:"document.visibilityState"}),"\nâ€“ it allows detecting if the current tab is active:"]}),"\n",(0,s.jsx)(i,{data:r}),"\n",(0,s.jsx)(t.h2,{id:"definition",children:"Definition"}),"\n",(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-tsx",children:"function useDocumentVisibility(): 'visible' | 'hidden';\n"})})]})}function u(){let e=arguments.length&gt;0&amp;&amp;void 0!==arguments[0]?arguments[0]:{};return(0,s.jsx)(l,{...e,children:(0,s.jsx)(v,{...e})})}},87186:(e,t,i)=&gt;{"use strict";i.d(t,{A:()=&gt;s});var s=(0,i(73366).A)("outline","adjustments","IconAdjustments",[["path",{d:"M4 10a2 2 0 1 0 4 0a2 2 0 0 0 -4 0",key:"svg-0"}],["path",{d:"M6 4v4",key:"svg-1"}],["path",{d:"M6 12v8",key:"svg-2"}],["path",{d:"M10 16a2 2 0 1 0 4 0a2 2 0 0 0 -4 0",key:"svg-3"}],["path",{d:"M12 4v10",key:"svg-4"}],["path",{d:"M12 18v2",key:"svg-5"}],["path",{d:"M16 7a2 2 0 1 0 4 0a2 2 0 0 0 -4 0",key:"svg-6"}],["path",{d:"M18 4v1",key:"svg-7"}],["path",{d:"M18 9v11",key:"svg-8"}]])},80502:(e,t,i)=&gt;{"use strict";i.d(t,{A:()=&gt;s});var s=(0,i(73366).A)("outline","arrow-left","IconArrowLeft",[["path",{d:"M5 12l14 0",key:"svg-0"}],["path",{d:"M5 12l6 6",key:"svg-1"}],["path",{d:"M5 12l6 -6",key:"svg-2"}]])},89689:(e,t,i)=&gt;{"use strict";i.d(t,{A:()=&gt;s});var s=(0,i(73366).A)("outline","arrow-right","IconArrowRight",[["path",{d:"M5 12l14 0",key:"svg-0"}],["path",{d:"M13 18l6 -6",key:"svg-1"}],["path",{d:"M13 6l6 6",key:"svg-2"}]])},61584:(e,t,i)=&gt;{"use strict";i.d(t,{A:()=&gt;s});var s=(0,i(73366).A)("outline","calendar","IconCalendar",[["path",{d:"M4 7a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2v-12z",key:"svg-0"}],["path",{d:"M16 3v4",key:"svg-1"}],["path",{d:"M8 3v4",key:"svg-2"}],["path",{d:"M4 11h16",key:"svg-3"}],["path",{d:"M11 15h1",key:"svg-4"}],["path",{d:"M12 15v3",key:"svg-5"}]])},91133:(e,t,i)=&gt;{"use strict";i.d(t,{A:()=&gt;s});var s=(0,i(73366).A)("outline","code","IconCode",[["path",{d:"M7 8l-4 4l4 4",key:"svg-0"}],["path",{d:"M17 8l4 4l-4 4",key:"svg-1"}],["path",{d:"M14 4l-4 16",key:"svg-2"}]])},11749:(e,t,i)=&gt;{"use strict";i.d(t,{A:()=&gt;s});var s=(0,i(73366).A)("outline","file-text","IconFileText",[["path",{d:"M14 3v4a1 1 0 0 0 1 1h4",key:"svg-0"}],["path",{d:"M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z",key:"svg-1"}],["path",{d:"M9 9l1 0",key:"svg-2"}],["path",{d:"M9 13l6 0",key:"svg-3"}],["path",{d:"M9 17l6 0",key:"svg-4"}]])},89843:(e,t,i)=&gt;{"use strict";i.d(t,{A:()=&gt;s});var s=(0,i(73366).A)("outline","license","IconLicense",[["path",{d:"M15 21h-9a3 3 0 0 1 -3 -3v-1h10v2a2 2 0 0 0 4 0v-14a2 2 0 1 1 2 2h-2m2 -4h-11a3 3 0 0 0 -3 3v11",key:"svg-0"}],["path",{d:"M9 7l4 0",key:"svg-1"}],["path",{d:"M9 11l4 0",key:"svg-2"}]])},9613:(e,t,i)=&gt;{"use strict";i.d(t,{A:()=&gt;s});var s=(0,i(73366).A)("outline","pencil","IconPencil",[["path",{d:"M4 20h4l10.5 -10.5a2.828 2.828 0 1 0 -4 -4l-10.5 10.5v4",key:"svg-0"}],["path",{d:"M13.5 6.5l4 4",key:"svg-1"}]])},55764:(e,t,i)=&gt;{"use strict";i.d(t,{A:()=&gt;s});var s=(0,i(73366).A)("outline","switch-2","IconSwitch2",[["path",{d:"M3 17h5l1.67 -2.386m3.66 -5.227l1.67 -2.387h6",key:"svg-0"}],["path",{d:"M18 4l3 3l-3 3",key:"svg-1"}],["path",{d:"M3 7h5l7 10h6",key:"svg-2"}],["path",{d:"M18 20l3 -3l-3 -3",key:"svg-3"}]])},35033:(e,t,i)=&gt;{"use strict";i.d(t,{r:()=&gt;n});var s=i(89571);function n(e){(0,s.o)(()=&gt;{"string"==typeof e&amp;&amp;e.trim().length&gt;0&amp;&amp;(document.title=e.trim())},[e])}}},e=&gt;{var t=t=&gt;e(e.s=t);e.O(0,[18675,90636,46593,38792],()=&gt;t(19081)),_N_E=e.O()}]);</pre></body></html>