mirror of
https://github.com/anomalyco/opencode.git
synced 2026-04-24 14:55:19 +00:00
12 lines
351 B
TypeScript
12 lines
351 B
TypeScript
import { createSignal } from "solid-js"
|
|
|
|
export const pageVisible = /* @__PURE__ */ (() => {
|
|
const [visible, setVisible] = createSignal(true)
|
|
if (typeof document !== "undefined") {
|
|
const sync = () => setVisible(document.visibilityState !== "hidden")
|
|
sync()
|
|
document.addEventListener("visibilitychange", sync)
|
|
}
|
|
return visible
|
|
})()
|