@capacitor-community/keep-awake
Advanced tools
Comparing version 2.1.1 to 3.0.0-dev.4f57a55.1680890143
@@ -27,2 +27,14 @@ { | ||
"slug": "allowsleep" | ||
}, | ||
{ | ||
"name": "isSupported", | ||
"signature": "() => Promise<IsSupportedResult>", | ||
"parameters": [], | ||
"returns": "Promise<IsSupportedResult>", | ||
"tags": [], | ||
"docs": "Whether keep awake is supported or not.", | ||
"complexTypes": [ | ||
"IsSupportedResult" | ||
], | ||
"slug": "issupported" | ||
} | ||
@@ -32,3 +44,20 @@ ], | ||
}, | ||
"interfaces": [], | ||
"interfaces": [ | ||
{ | ||
"name": "IsSupportedResult", | ||
"slug": "issupportedresult", | ||
"docs": "", | ||
"tags": [], | ||
"methods": [], | ||
"properties": [ | ||
{ | ||
"name": "isSupported", | ||
"tags": [], | ||
"docs": "", | ||
"complexTypes": [], | ||
"type": "boolean" | ||
} | ||
] | ||
} | ||
], | ||
"enums": [], | ||
@@ -35,0 +64,0 @@ "typeAliases": [], |
@@ -10,2 +10,9 @@ export interface KeepAwakePlugin { | ||
allowSleep(): Promise<void>; | ||
/** | ||
* Whether keep awake is supported or not. | ||
*/ | ||
isSupported(): Promise<IsSupportedResult>; | ||
} | ||
export interface IsSupportedResult { | ||
isSupported: boolean; | ||
} |
import { WebPlugin } from '@capacitor/core'; | ||
import type { KeepAwakePlugin } from './definitions'; | ||
import type { IsSupportedResult, KeepAwakePlugin } from './definitions'; | ||
export declare class KeepAwakeWeb extends WebPlugin implements KeepAwakePlugin { | ||
private wakeLock; | ||
private readonly isSupported; | ||
private readonly _isSupported; | ||
keepAwake(): Promise<void>; | ||
allowSleep(): Promise<void>; | ||
isSupported(): Promise<IsSupportedResult>; | ||
private throwUnsupportedError; | ||
} |
@@ -6,6 +6,6 @@ import { WebPlugin } from '@capacitor/core'; | ||
this.wakeLock = null; | ||
this.isSupported = 'wakeLock' in navigator; | ||
this._isSupported = 'wakeLock' in navigator; | ||
} | ||
async keepAwake() { | ||
if (!this.isSupported) { | ||
if (!this._isSupported) { | ||
this.throwUnsupportedError(); | ||
@@ -20,3 +20,3 @@ } | ||
var _a; | ||
if (!this.isSupported) { | ||
if (!this._isSupported) { | ||
this.throwUnsupportedError(); | ||
@@ -27,2 +27,8 @@ } | ||
} | ||
async isSupported() { | ||
const result = { | ||
isSupported: this._isSupported, | ||
}; | ||
return result; | ||
} | ||
throwUnsupportedError() { | ||
@@ -29,0 +35,0 @@ throw this.unavailable('Screen Wake Lock API not available in this browser.'); |
@@ -15,6 +15,6 @@ 'use strict'; | ||
this.wakeLock = null; | ||
this.isSupported = 'wakeLock' in navigator; | ||
this._isSupported = 'wakeLock' in navigator; | ||
} | ||
async keepAwake() { | ||
if (!this.isSupported) { | ||
if (!this._isSupported) { | ||
this.throwUnsupportedError(); | ||
@@ -29,3 +29,3 @@ } | ||
var _a; | ||
if (!this.isSupported) { | ||
if (!this._isSupported) { | ||
this.throwUnsupportedError(); | ||
@@ -36,2 +36,8 @@ } | ||
} | ||
async isSupported() { | ||
const result = { | ||
isSupported: this._isSupported, | ||
}; | ||
return result; | ||
} | ||
throwUnsupportedError() { | ||
@@ -38,0 +44,0 @@ throw this.unavailable('Screen Wake Lock API not available in this browser.'); |
@@ -12,6 +12,6 @@ var capacitorKeepAwake = (function (exports, core) { | ||
this.wakeLock = null; | ||
this.isSupported = 'wakeLock' in navigator; | ||
this._isSupported = 'wakeLock' in navigator; | ||
} | ||
async keepAwake() { | ||
if (!this.isSupported) { | ||
if (!this._isSupported) { | ||
this.throwUnsupportedError(); | ||
@@ -26,3 +26,3 @@ } | ||
var _a; | ||
if (!this.isSupported) { | ||
if (!this._isSupported) { | ||
this.throwUnsupportedError(); | ||
@@ -33,2 +33,8 @@ } | ||
} | ||
async isSupported() { | ||
const result = { | ||
isSupported: this._isSupported, | ||
}; | ||
return result; | ||
} | ||
throwUnsupportedError() { | ||
@@ -50,3 +56,3 @@ throw this.unavailable('Screen Wake Lock API not available in this browser.'); | ||
}({}, capacitorExports)); | ||
})({}, capacitorExports); | ||
//# sourceMappingURL=plugin.js.map |
{ | ||
"name": "@capacitor-community/keep-awake", | ||
"version": "2.1.1", | ||
"version": "3.0.0-dev.4f57a55.1680890143", | ||
"description": "Prevent your screen from getting some sleep!", | ||
@@ -32,3 +32,3 @@ "main": "dist/plugin.cjs.js", | ||
"verify": "npm run verify:ios && npm run verify:android && npm run verify:web", | ||
"verify:ios": "cd ios && pod install && xcodebuild -workspace Plugin.xcworkspace -scheme Plugin && cd ..", | ||
"verify:ios": "cd ios && pod install && xcodebuild -workspace Plugin.xcworkspace -scheme Plugin -destination generic/platform=iOS && cd ..", | ||
"verify:android": "cd android && ./gradlew clean build test && cd ..", | ||
@@ -49,7 +49,7 @@ "verify:web": "npm run build", | ||
"devDependencies": { | ||
"@capacitor/android": "3.4.0", | ||
"@capacitor/cli": "3.4.0", | ||
"@capacitor/core": "3.4.0", | ||
"@capacitor/docgen": "0.0.18", | ||
"@capacitor/ios": "3.4.0", | ||
"@capacitor/android": "5.0.0-beta.1", | ||
"@capacitor/cli": "5.0.0-beta.1", | ||
"@capacitor/core": "5.0.0-beta.1", | ||
"@capacitor/docgen": "0.2.0", | ||
"@capacitor/ios": "5.0.0-beta.1", | ||
"@ionic/eslint-config": "0.3.0", | ||
@@ -59,13 +59,13 @@ "@ionic/prettier-config": "1.0.1", | ||
"@types/dom-screen-wake-lock": "1.0.0", | ||
"eslint": "7.11.0", | ||
"prettier": "2.2.0", | ||
"prettier-plugin-java": "1.0.0", | ||
"eslint": "7.32.0", | ||
"prettier": "2.3.2", | ||
"prettier-plugin-java": "1.0.2", | ||
"rimraf": "3.0.2", | ||
"rollup": "2.32.0", | ||
"standard-version": "9.1.0", | ||
"rollup": "2.77.2", | ||
"standard-version": "9.5.0", | ||
"swiftlint": "1.0.1", | ||
"typescript": "4.0.3" | ||
"typescript": "4.1.5" | ||
}, | ||
"peerDependencies": { | ||
"@capacitor/core": "^3.0.0" | ||
"@capacitor/core": "^5.0.0-beta.1" | ||
}, | ||
@@ -72,0 +72,0 @@ "prettier": "@ionic/prettier-config", |
@@ -9,4 +9,4 @@ <p align="center"><br><img src="https://user-images.githubusercontent.com/236501/85893648-1c92e880-b7a8-11ea-926d-95355b8175c7.png" width="128" height="128" /></p> | ||
<p align="center"> | ||
<img src="https://img.shields.io/maintenance/yes/2022?style=flat-square" /> | ||
<a href="https://github.com/capacitor-community/keep-awake/actions?query=workflow%3A%22CI%22"><img src="https://img.shields.io/github/workflow/status/capacitor-community/keep-awake/CI/master?style=flat-square" /></a> | ||
<img src="https://img.shields.io/maintenance/yes/2023?style=flat-square" /> | ||
<a href="https://github.com/capacitor-community/keep-awake/actions?query=workflow%3A%22CI%22"><img src="https://img.shields.io/github/actions/workflow/status/capacitor-community/keep-awake/ci.yml?branch=master&style=flat-square" /></a> | ||
<a href="https://www.npmjs.com/package/@capacitor-community/keep-awake"><img src="https://img.shields.io/npm/l/@capacitor-community/keep-awake?style=flat-square" /></a> | ||
@@ -55,2 +55,8 @@ <br> | ||
}; | ||
const isSupported = async () => { | ||
const result = await KeepAwake.isSupported(); | ||
return result.isSupported; | ||
}; | ||
``` | ||
@@ -64,2 +70,4 @@ | ||
* [`allowSleep()`](#allowsleep) | ||
* [`isSupported()`](#issupported) | ||
* [Interfaces](#interfaces) | ||
@@ -92,2 +100,25 @@ </docgen-index> | ||
### isSupported() | ||
```typescript | ||
isSupported() => Promise<IsSupportedResult> | ||
``` | ||
Whether keep awake is supported or not. | ||
**Returns:** <code>Promise<<a href="#issupportedresult">IsSupportedResult</a>></code> | ||
-------------------- | ||
### Interfaces | ||
#### IsSupportedResult | ||
| Prop | Type | | ||
| ----------------- | -------------------- | | ||
| **`isSupported`** | <code>boolean</code> | | ||
</docgen-api> | ||
@@ -94,0 +125,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
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
29503
272
129
2