Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/filipchalupa/react-keep-awake
React component and hook to keep screen awake.
https://github.com/filipchalupa/react-keep-awake
Last synced: about 14 hours ago
JSON representation
React component and hook to keep screen awake.
- Host: GitHub
- URL: https://github.com/filipchalupa/react-keep-awake
- Owner: FilipChalupa
- Created: 2023-01-12T20:13:01.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-05-16T12:26:48.000Z (6 months ago)
- Last Synced: 2024-10-31T10:52:20.475Z (7 days ago)
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/react-keep-awake
- Size: 522 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# React keep awake [![npm](https://img.shields.io/npm/v/react-keep-awake.svg)](https://www.npmjs.com/package/react-keep-awake) ![npm type definitions](https://img.shields.io/npm/types/react-keep-awake.svg)
React component and hook to keep screen awake using [Screen Wake Lock API](https://developer.mozilla.org/en-US/docs/Web/API/Screen_Wake_Lock_API).
## Installation
```bash
npm install react-keep-awake
```## How to use
To keep screen awake by component:
```jsx
import { KeepAwake } from 'react-keep-awake'const MyApp = () => {
return (
Lorem ipsum
)
}
```To keep screen awake by hook:
```jsx
import { useKeepAwake } from 'react-keep-awake'const MyApp = () => {
useKeepAwake()return (
Lorem ipsum
)
}
```## Development
```bash
npm ci
npm run dev
```