Skip to content

oomol-lab/mac-power-monitor

Repository files navigation

mac-power-monitor

Test Service

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();