🚀 Socket Launch Week 🚀 Day 1: Introducing .NET Support in Socket.Learn More
Socket
Sign inDemoInstall
Socket

@solid-primitives/page-visibility

Package Overview
Dependencies
Maintainers
3
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@solid-primitives/page-visibility

Primitive to track page visibility

2.1.0
latest
Source
npm
Version published
Maintainers
3
Created
Source

Solid Primitives Page Visibility

@solid-primitives/page-visibility

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

Keywords

page

FAQs

Package last updated on 22 Jan 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts