0.0.4 • Published 3 years ago

node-prevent-sleep v0.0.4

Weekly downloads
9
License
MIT
Repository
github
Last release
3 years ago

node-prevent-sleep

Allows to prevent the system from turning off the display, or suspending the computer.

Usage

const preventSleep = require("node-prevent-sleep");
// import preventSleep from 'node-prevent-sleep';

// Disables sleep
preventSleep.enable();

// Enables sleep
preventSleep.disable();

How it works

Windows

When enable() is used, power request is created using PowerCreateRequest and set using PowerSetRequest with flags PowerRequestSystemRequired and PowerRequestDisplayRequired, which prevents system sleeping.

When disable() is used, power request is cleared using PowerClearRequest, restoring previous behavior.

Linux

Not supported yet. You are welcome to submit a PR with the functionality.

Mac

Not supported yet. You are welcome to submit a PR with the functionality.

License

MIT

0.0.3

3 years ago

0.0.4

3 years ago

0.0.2

4 years ago

0.0.1

4 years ago