
保持清醒
@capacitor-community/keep-awake
QQ Capacitor 插件来防止设备暗淡或锁定屏幕.
维护者
| 维护者 | GitHub 图像 | 社会 |
|---|---|---|
| 凯文·布斯滕 | 树苗 | @克文布斯腾 |
| 罗宾·根兹 | 抢劫 | @robin genz (中文(简体) ) |
安装
npm install @capacitor-community/keep-awake
npx cap sync
配置
此插件不需要配置 .
演示
一个实例可以在实例应用文件夹中找到.
使用量
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() => Promise<void>
防止设备暗化屏幕.
允许睡眠( C)
allowSleep() => Promise<void>
允许设备淡出屏幕 .
已支持 ()
isSupported() => Promise<IsSupportedResult>
是否保持清醒得到支持 .
回返情况: Promise<IsSupportedResult>
是 KeptAwake () 语句
isKeptAwake() => Promise<IsKeptAwakeResult>
检查设备是否保持了清醒.
回返情况: Promise<IsKeptAwakeResult>
接口
支持的结果
| Prop | 类型 |
|---|---|
isSupported | boolean |
觉醒复出
| Prop | 类型 |
|---|---|
isKeptAwake | boolean |
更改日志
见 变动情况。 。 。 .
许可证
见 自由主义。 。 。 .