5.0.1 • Published 1 year ago

@jigra-community/keep-awake v5.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Installation

npm install @jigra-community/keep-awake
npx jig sync

Configuration

No configuration required for this plugin.

Usage

import { KeepAwake } from '@jigra-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() => Promise<void>

Prevent the device from dimming the screen.


allowSleep()

allowSleep() => Promise<void>

Allow the device to dim the screen.


isSupported()

isSupported() => Promise<IsSupportedResult>

Whether keep awake is supported or not.

Returns: Promise<IsSupportedResult>


isKeptAwake()

isKeptAwake() => Promise<IsKeptAwakeResult>

Check if the device is kept awake.

Returns: Promise<IsKeptAwakeResult>


Interfaces

IsSupportedResult

PropType
isSupportedboolean

IsKeptAwakeResult

PropType
isKeptAwakeboolean

License

See LICENSE.

5.0.1

1 year ago