@capacitor-community/keep-awake
Advanced tools
Comparing version 2.1.0 to 2.1.1-dev.1390021.1659192262
@@ -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; | ||
} |
export {}; | ||
//# sourceMappingURL=definitions.js.map |
@@ -0,0 +0,0 @@ import type { KeepAwakePlugin } from './definitions'; |
@@ -0,0 +0,0 @@ import { registerPlugin } from '@capacitor/core'; |
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.0", | ||
"version": "2.1.1-dev.1390021.1659192262", | ||
"description": "Prevent your screen from getting some sleep!", | ||
@@ -32,7 +32,7 @@ "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 ..", | ||
"verify:web": "npm run build", | ||
"lint": "npm run eslint && npm run prettier -- --check && npm run swiftlint -- lint", | ||
"fmt": "npm run eslint -- --fix && npm run prettier -- --write && npm run swiftlint -- autocorrect --format", | ||
"fmt": "npm run eslint -- --fix && npm run prettier -- --write && npm run swiftlint -- --fix --format", | ||
"eslint": "eslint . --ext ts", | ||
@@ -49,7 +49,7 @@ "prettier": "prettier \"**/*.{css,html,ts,js,java}\"", | ||
"devDependencies": { | ||
"@capacitor/android": "3.0.0-beta.6", | ||
"@capacitor/cli": "3.0.0-beta.6", | ||
"@capacitor/core": "3.0.0-beta.6", | ||
"@capacitor/docgen": "0.0.16", | ||
"@capacitor/ios": "3.0.0-beta.6", | ||
"@capacitor/android": "4.0.1", | ||
"@capacitor/cli": "4.0.1", | ||
"@capacitor/core": "4.0.1", | ||
"@capacitor/docgen": "0.2.0", | ||
"@capacitor/ios": "4.0.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-beta.6" | ||
"@capacitor/core": "^4.0.0" | ||
}, | ||
@@ -72,0 +72,0 @@ "prettier": "@ionic/prettier-config", |
@@ -5,7 +5,7 @@ <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"> | ||
Capacitor community plugin to prevent your screen from getting some sleep! | ||
⚡️ Capacitor plugin to prevent devices from dimming or locking the screen. | ||
</p> | ||
<p align="center"> | ||
<img src="https://img.shields.io/maintenance/yes/2021?style=flat-square" /> | ||
<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> | ||
@@ -23,10 +23,10 @@ <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> | ||
| Maintainer | GitHub | Social | | ||
| ---------- | ----------------------------------------- | --------------------------------------------- | | ||
| Kevin Boosten | [boosten](https://github.com/boosten) | [@Boostuh1](https://twitter.com/Boostuh1) | | ||
| Robin Genz | [robingenz](https://github.com/robingenz) | [@robin_genz](https://twitter.com/robin_genz) | | ||
| 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 | ||
@@ -50,8 +50,14 @@ npx cap sync | ||
const keepAwake = async () => { | ||
await KeepAwake.keepAwake(); | ||
} | ||
await KeepAwake.keepAwake(); | ||
}; | ||
const allowSleep = async () => { | ||
await KeepAwake.allowSleep(); | ||
} | ||
await KeepAwake.allowSleep(); | ||
}; | ||
const isSupported = async () => { | ||
const result = await KeepAwake.isSupported(); | ||
return result.isSupported; | ||
}; | ||
``` | ||
@@ -65,2 +71,4 @@ | ||
* [`allowSleep()`](#allowsleep) | ||
* [`isSupported()`](#issupported) | ||
* [Interfaces](#interfaces) | ||
@@ -93,2 +101,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> | ||
@@ -95,0 +126,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
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
29447
272
129
26
2