@capacitor-community/keep-awake
Advanced tools
Comparing version 3.0.0-dev.4f57a55.1680890143 to 3.0.0-dev.a4d5a8d.1683032576
@@ -39,2 +39,14 @@ { | ||
"slug": "issupported" | ||
}, | ||
{ | ||
"name": "isKeptAwake", | ||
"signature": "() => Promise<IsKeptAwakeResult>", | ||
"parameters": [], | ||
"returns": "Promise<IsKeptAwakeResult>", | ||
"tags": [], | ||
"docs": "Check if the device is kept awake.", | ||
"complexTypes": [ | ||
"IsKeptAwakeResult" | ||
], | ||
"slug": "iskeptawake" | ||
} | ||
@@ -60,2 +72,18 @@ ], | ||
] | ||
}, | ||
{ | ||
"name": "IsKeptAwakeResult", | ||
"slug": "iskeptawakeresult", | ||
"docs": "", | ||
"tags": [], | ||
"methods": [], | ||
"properties": [ | ||
{ | ||
"name": "isKeptAwake", | ||
"tags": [], | ||
"docs": "", | ||
"complexTypes": [], | ||
"type": "boolean" | ||
} | ||
] | ||
} | ||
@@ -62,0 +90,0 @@ ], |
@@ -14,2 +14,6 @@ export interface KeepAwakePlugin { | ||
isSupported(): Promise<IsSupportedResult>; | ||
/** | ||
* Check if the device is kept awake. | ||
*/ | ||
isKeptAwake(): Promise<IsKeptAwakeResult>; | ||
} | ||
@@ -19,1 +23,4 @@ export interface IsSupportedResult { | ||
} | ||
export interface IsKeptAwakeResult { | ||
isKeptAwake: boolean; | ||
} |
import { WebPlugin } from '@capacitor/core'; | ||
import type { IsSupportedResult, KeepAwakePlugin } from './definitions'; | ||
import type { IsKeptAwakeResult, IsSupportedResult, KeepAwakePlugin } from './definitions'; | ||
export declare class KeepAwakeWeb extends WebPlugin implements KeepAwakePlugin { | ||
@@ -9,3 +9,4 @@ private wakeLock; | ||
isSupported(): Promise<IsSupportedResult>; | ||
isKeptAwake(): Promise<IsKeptAwakeResult>; | ||
private throwUnsupportedError; | ||
} |
@@ -31,2 +31,11 @@ import { WebPlugin } from '@capacitor/core'; | ||
} | ||
async isKeptAwake() { | ||
if (!this._isSupported) { | ||
this.throwUnsupportedError(); | ||
} | ||
const result = { | ||
isKeptAwake: !!this.wakeLock, | ||
}; | ||
return result; | ||
} | ||
throwUnsupportedError() { | ||
@@ -33,0 +42,0 @@ throw this.unavailable('Screen Wake Lock API not available in this browser.'); |
@@ -40,2 +40,11 @@ 'use strict'; | ||
} | ||
async isKeptAwake() { | ||
if (!this._isSupported) { | ||
this.throwUnsupportedError(); | ||
} | ||
const result = { | ||
isKeptAwake: !!this.wakeLock, | ||
}; | ||
return result; | ||
} | ||
throwUnsupportedError() { | ||
@@ -42,0 +51,0 @@ throw this.unavailable('Screen Wake Lock API not available in this browser.'); |
@@ -37,2 +37,11 @@ var capacitorKeepAwake = (function (exports, core) { | ||
} | ||
async isKeptAwake() { | ||
if (!this._isSupported) { | ||
this.throwUnsupportedError(); | ||
} | ||
const result = { | ||
isKeptAwake: !!this.wakeLock, | ||
}; | ||
return result; | ||
} | ||
throwUnsupportedError() { | ||
@@ -39,0 +48,0 @@ throw this.unavailable('Screen Wake Lock API not available in this browser.'); |
{ | ||
"name": "@capacitor-community/keep-awake", | ||
"version": "3.0.0-dev.4f57a55.1680890143", | ||
"version": "3.0.0-dev.a4d5a8d.1683032576", | ||
"description": "Prevent your screen from getting some sleep!", | ||
@@ -48,7 +48,7 @@ "main": "dist/plugin.cjs.js", | ||
"devDependencies": { | ||
"@capacitor/android": "5.0.0-beta.1", | ||
"@capacitor/cli": "5.0.0-beta.1", | ||
"@capacitor/core": "5.0.0-beta.1", | ||
"@capacitor/android": "4.0.1", | ||
"@capacitor/cli": "4.0.1", | ||
"@capacitor/core": "4.0.1", | ||
"@capacitor/docgen": "0.2.0", | ||
"@capacitor/ios": "5.0.0-beta.1", | ||
"@capacitor/ios": "4.0.1", | ||
"@ionic/eslint-config": "0.3.0", | ||
@@ -68,3 +68,3 @@ "@ionic/prettier-config": "1.0.1", | ||
"peerDependencies": { | ||
"@capacitor/core": "^5.0.0-beta.1" | ||
"@capacitor/core": "^4.0.0" | ||
}, | ||
@@ -71,0 +71,0 @@ "prettier": "@ionic/prettier-config", |
@@ -55,3 +55,2 @@ <p align="center"><br><img src="https://user-images.githubusercontent.com/236501/85893648-1c92e880-b7a8-11ea-926d-95355b8175c7.png" width="128" height="128" /></p> | ||
const isSupported = async () => { | ||
@@ -61,2 +60,7 @@ const result = await KeepAwake.isSupported(); | ||
}; | ||
const isKeptAwake = async () => { | ||
const result = await KeepAwake.isKeptAwake(); | ||
return result.isKeptAwake; | ||
}; | ||
``` | ||
@@ -71,2 +75,3 @@ | ||
* [`isSupported()`](#issupported) | ||
* [`isKeptAwake()`](#iskeptawake) | ||
* [Interfaces](#interfaces) | ||
@@ -114,2 +119,15 @@ | ||
### isKeptAwake() | ||
```typescript | ||
isKeptAwake() => Promise<IsKeptAwakeResult> | ||
``` | ||
Check if the device is kept awake. | ||
**Returns:** <code>Promise<<a href="#iskeptawakeresult">IsKeptAwakeResult</a>></code> | ||
-------------------- | ||
### Interfaces | ||
@@ -124,2 +142,9 @@ | ||
#### IsKeptAwakeResult | ||
| Prop | Type | | ||
| ----------------- | -------------------- | | ||
| **`isKeptAwake`** | <code>boolean</code> | | ||
</docgen-api> | ||
@@ -126,0 +151,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
33929
344
154