This package has been deprecated

Author message:

Package has been renamed to @solid-primitives/page-visibility

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

2.0.1 • Public • Published

Solid Primitives Visibility Observer

@solid-primitives/visibility-observer

lerna size size stage

Installation

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

createPageVisibility

Creates a signal with a boolean value identifying the page visibility state.

How to use it

import { createPageVisibility } from "@solid-primitives/visibility-observer";

const visible = createPageVisibility();

createEffect(() => {
  visible(); // => boolean
});

usePageVisibility

usePageVisibility is a shared 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/visibility-observer";

const visible = usePageVisibility();

createEffect(() => {
  visible(); // => boolean
});

Changelog

Expand Changelog

1.0.0

Initial commit of the visibility observer.

2.0.0

Rename createPageVisibilityObserver to createPageVisibility (no longer exported as default)

Add usePageVisibility

Package Sidebar

Install

npm i @solid-primitives/visibility-observer

Weekly Downloads

1

Version

2.0.1

License

MIT

Unpacked Size

9.96 kB

Total Files

8

Last publish

Collaborators

  • davedbase
  • lexlohr
  • thetarnav.