@oomol-lab/mac-power-monitor
v1.0.0
Published
macOS Sleep / Wake notifications
Downloads
4
Keywords
Readme
mac-power-monitor
Inspiration from: prashantgupta24/mac-sleep-notifier
Install
pnpm add @oomol-lab/mac-power-monitor
# or
npm install @oomol-lab/mac-power-monitor
# or
yarn add @oomol-lab/mac-power-monitor
Usage
import { createMacPowerMonitor } from "@oomol-lab/mac-power-monitor";
const monitor = createMacPowerMonitor();
monitor.listenOnWillSleep(function () {
console.log("will sleep");
});
monitor.listenOnWillWake(function () {
console.log("will wake");
});
// when we don't need it
monitor.dispose();