cordova-plugin-insomnia
Version:
Prevent the screen of the mobile device from falling asleep.
17 lines (14 loc) • 373 B
JavaScript
var lock;
module.exports = {
keepAwake: function() {
if (navigator.requestWakeLock) {
lock = navigator.requestWakeLock("screen");
}
},
allowSleepAgain: function() {
if (lock && typeof lock.unlock === "function") {
lock.unlock();
}
}
};
require("cordova/exec/proxy").add("Insomnia", module.exports);