Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/capacitor-community/keep-awake
⚡️ Capacitor plugin to prevent devices from dimming or locking the screen.
https://github.com/capacitor-community/keep-awake
android capacitor capacitor-community capacitor-plugin ios web
Last synced: 19 days ago
JSON representation
⚡️ Capacitor plugin to prevent devices from dimming or locking the screen.
- Host: GitHub
- URL: https://github.com/capacitor-community/keep-awake
- Owner: capacitor-community
- License: mit
- Created: 2019-12-03T15:12:45.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2024-04-16T06:57:22.000Z (8 months ago)
- Last Synced: 2024-04-27T07:25:13.001Z (8 months ago)
- Topics: android, capacitor, capacitor-community, capacitor-plugin, ios, web
- Language: Java
- Homepage:
- Size: 546 KB
- Stars: 113
- Watchers: 10
- Forks: 13
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
- awesome-capacitorjs - @capacitor-community/keep-awake - Capacitor plugin to prevent devices from dimming or locking the screen. (Plugins / Community Plugins)
- awesome-capacitor - Keep awake - Prevent your screen from getting some sleep. (Community plugins)
README
Keep Awake
@capacitor-community/keep-awake
⚡️ Capacitor plugin to prevent devices from dimming or locking the screen.## Maintainers
| Maintainer | GitHub | Social |
| ------------- | ----------------------------------------------- | ------------------------------------------------- |
| Kevin Boosten | [kevinboosten](https://github.com/kevinboosten) | [@kevinboosten](https://twitter.com/kevinboosten) |
| Robin Genz | [robingenz](https://github.com/robingenz) | [@robin_genz](https://twitter.com/robin_genz) |## Installation
```shell
npm install @capacitor-community/keep-awake
npx cap sync
```## Configuration
No configuration required for this plugin.
## Demo
A working example can be found here: [robingenz/capacitor-plugin-demo](https://github.com/robingenz/capacitor-plugin-demo)
## Usage
```typescript
import { KeepAwake } from '@capacitor-community/keep-awake';const keepAwake = async () => {
await KeepAwake.keepAwake();
};const allowSleep = async () => {
await KeepAwake.allowSleep();
};const isSupported = async () => {
const result = await KeepAwake.isSupported();
return result.isSupported;
};const isKeptAwake = async () => {
const result = await KeepAwake.isKeptAwake();
return result.isKeptAwake;
};
```## API
* [`keepAwake()`](#keepawake)
* [`allowSleep()`](#allowsleep)
* [`isSupported()`](#issupported)
* [`isKeptAwake()`](#iskeptawake)
* [Interfaces](#interfaces)### keepAwake()
```typescript
keepAwake() => Promise
```Prevent the device from dimming the screen.
--------------------
### allowSleep()
```typescript
allowSleep() => Promise
```Allow the device to dim the screen.
--------------------
### isSupported()
```typescript
isSupported() => Promise
```Whether keep awake is supported or not.
**Returns:**
Promise<IsSupportedResult>
--------------------
### isKeptAwake()
```typescript
isKeptAwake() => Promise
```Check if the device is kept awake.
**Returns:**
Promise<IsKeptAwakeResult>
--------------------
### Interfaces
#### IsSupportedResult
| Prop | Type |
| ----------------- | -------------------- |
| **`isSupported`** |boolean
|#### IsKeptAwakeResult
| Prop | Type |
| ----------------- | -------------------- |
| **`isKeptAwake`** |boolean
|## Changelog
See [CHANGELOG.md](https://github.com/capacitor-community/keep-awake/blob/master/CHANGELOG.md).
## License
See [LICENSE](https://github.com/capacitor-community/keep-awake/blob/master/LICENSE).