#Installation
npm install @solid-primitives/page-visibility
yarn add @solid-primitives/page-visibility
pnpm add @solid-primitives/page-visibility
#Readme
createPageVisibility
- Creates a signal with a boolean value identifying the page visibility stateusePageVisibility
- A singleton root alternative.
#createPageVisibility
Creates a signal with a boolean value identifying the page visibility state.
#How to use it
import { createPageVisibility } from "@solid-primitives/page-visibility";
const visible = createPageVisibility();
createEffect(() => {
visible(); // => boolean
});
#usePageVisibility
usePageVisibility
is a singleton root primitive. It is providing the same signal as createPageVisibility
, but the event-listener and the signal are shared between dependents, making it more optimized to use in multiple places at once.
#How to use it
import { usePageVisibility } from "@solid-primitives/page-visibility";
const visible = usePageVisibility();
createEffect(() => {
visible(); // => boolean
});
#Changelog
See CHANGELOG.md