@solid-primitives/page-visibility
TypeScript icon, indicating that this package has built-in type declarations

2.0.17 • Public • Published

Solid Primitives Page Visibility

@solid-primitives/page-visibility

turborepo size size stage

Installation

npm install @solid-primitives/page-visibility
# or
yarn add @solid-primitives/page-visibility

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

Package Sidebar

Install

npm i @solid-primitives/page-visibility

Weekly Downloads

1,056

Version

2.0.17

License

MIT

Unpacked Size

8.95 kB

Total Files

8

Last publish

Collaborators

  • thetarnav.
  • lexlohr
  • davedbase