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

6.4.4 • Public • Published

Installation

npm install --save @types/react-page-visibility

Summary

This package contains type definitions for react-page-visibility (https://github.com/pgilad/react-page-visibility#readme).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react-page-visibility.

index.d.ts

import { Component } from "react";

/**
 * A hook which returns whether the page is currently visible.
 */
export function usePageVisibility(): boolean;

/**
 * Note that support for these states differs by browser.
 */
export type KnownVisibilityStates = "visible" | "hidden" | "prerender" | "unloaded";

export interface PageVisibilityProps {
    children?:
        | React.ReactNode
        | ((isVisible: boolean, visibilityState: KnownVisibilityStates) => React.ReactNode)
        | undefined;
    onChange?: ((isVisible: boolean, visibilityState: KnownVisibilityStates) => void) | undefined;
}

/**
 * A higher order component for managing visibility state via the child
 * rendering pattern.
 */
export default class PageVisibility extends Component<PageVisibilityProps> {}

Additional Details

  • Last updated: Tue, 07 Nov 2023 09:09:39 GMT
  • Dependencies: @types/react

Credits

These definitions were written by Daniel.

Readme

Keywords

none

Package Sidebar

Install

npm i @types/react-page-visibility

Weekly Downloads

38,320

Version

6.4.4

License

MIT

Unpacked Size

4.29 kB

Total Files

5

Last publish

Collaborators

  • types