Skip to content

Add API to tell system sleep/awake state #987

@matthewjamesadam

Description

@matthewjamesadam

Is your feature request related to a problem? Please describe.
I'd like to be able to tell when the system is "asleep".

On MacOS, for instance, when the laptop lid is closed, the system goes into sleep mode. In this mode, the system periodically wakes up for very brief amounts of time (100ms) -- during these periods, various system services (ie networking) are not reliably usable, but node apps do run.

I have a long-running node app that activates at these times, but I'd like to avoid processing when the system is in sleep mode.

I suspect windows/linux has similar concepts but I'm not certain.

Describe alternatives you've considered
I've considered building my own node addon for this, but having an NPM library with this makes it available to everyone.

Thank you for making this great library!

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions