Make the screen not dim (and eventually lock the device) while Insomnia is active.
[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.
```
tns plugin add @nativescript-community/insomnia
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";
`typescript`
insomnia.keepAwake().then(function() {
console.log("Insomnia is active");
})
`typescript``
insomnia.allowSleepAgain().then(function() {
console.log("Insomnia is inactive, good night!");
})