This plugin is part of the plugin showcase app I built using Angular.
Run the following command from the root of your project:
tns plugin add nativescript-insomnia
To use this plugin you must first require() it:
var insomnia = require("nativescript-insomnia");You could do the same as in JS, but this looks fancier, right?
const { keepAwake, allowSleepAgain } = require("nativescript-insomnia"); insomnia.keepAwake().then(function() {
console.log("Insomnia is active");
}) insomnia.allowSleepAgain().then(function() {
console.log("Insomnia is inactive, good night!");
})