react-keep-awake
TypeScript icon, indicating that this package has built-in type declarations

0.2.0 • Public • Published

React keep awake npm npm type definitions

React component and hook to keep screen awake using Screen Wake Lock API.

Installation

npm install react-keep-awake

How to use

To keep screen awake by component:

import { KeepAwake } from 'react-keep-awake'

const MyApp = () => {
	return (
		<main>
			<KeepAwake />
			<p>Lorem ipsum</p>
		</main>
	)
}

To keep screen awake by hook:

import { useKeepAwake } from 'react-keep-awake'

const MyApp = () => {
	useKeepAwake()

	return (
		<main>
			<p>Lorem ipsum</p>
		</main>
	)
}

Development

npm ci
npm run dev

/react-keep-awake/

    Package Sidebar

    Install

    npm i react-keep-awake

    Weekly Downloads

    131

    Version

    0.2.0

    License

    ISC

    Unpacked Size

    18.9 kB

    Total Files

    9

    Last publish

    Collaborators

    • onset