Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nativescript-community/insomnia
:sleepy: NativeScript plugin to keep the device awake (not dim the screen, lock, etc)
https://github.com/nativescript-community/insomnia
awake dimming insomnia nativescript nativescript-plugin screen
Last synced: about 1 month ago
JSON representation
:sleepy: NativeScript plugin to keep the device awake (not dim the screen, lock, etc)
- Host: GitHub
- URL: https://github.com/nativescript-community/insomnia
- Owner: nativescript-community
- Created: 2015-05-08T21:04:39.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2023-11-22T15:01:23.000Z (12 months ago)
- Last Synced: 2024-09-29T23:21:29.760Z (about 2 months ago)
- Topics: awake, dimming, insomnia, nativescript, nativescript-plugin, screen
- Language: JavaScript
- Homepage:
- Size: 679 KB
- Stars: 41
- Watchers: 17
- Forks: 11
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
Awesome Lists containing this project
README
# NativeScript Insomnia
[npm-image]:http://img.shields.io/npm/v/nativescript-community/insomnia.svg
[npm-url]:https://npmjs.org/package/nativescript-community/insomnia
[downloads-image]:http://img.shields.io/npm/dm/nativescript-community/insomnia.svg> 💡 Plugin version 2.0.0+ is compatible with NativeScript 7+. If you need to target older NativeScript versions, please stick to plugin version 1.2.3.
## Demo app (Angular)
This plugin is part of the [plugin showcase app](https://github.com/EddyVerbruggen/nativescript-pluginshowcase/tree/master/app/ar) I built using Angular.## Installation
Run the following command from the root of your project:```
tns plugin add @nativescript-community/insomnia
```## Usage
To use this plugin you must first require() it:
#### JavaScript
```js
var insomnia = require("@nativescript-community/insomnia");
```#### TypeScript
You could do the same as in JS, but this looks fancier, right?```typescript
import { keepAwake, allowSleepAgain } from "@nativescript-community/insomnia";
```### keepAwake
```typescript
insomnia.keepAwake().then(function() {
console.log("Insomnia is active");
})
```### allowSleepAgain
```typescript
insomnia.allowSleepAgain().then(function() {
console.log("Insomnia is inactive, good night!");
})
```