NativeScriptInsomnia是可以使得设备锁定然后屏幕不暗的NativeScript插件。
安装
tns plugin add nativescript-insomnia使用
var insomnia = require("nativescript-insomnia");keepAwake insomnia.keepAwake().then(function() { console.log("Insomnia is active"); })allowSleepAgain insomnia.allowSleepAgain().then(function() { console.log("Insomnia is inactive, good night!"); })
评论