@131/screensaver
v1.3.4
Published
[![Version](https://img.shields.io/npm/v/@131/screensaver.svg)](https://www.npmjs.com/package/@131/screensaver) [![License](https://img.shields.io/badge/license-MIT-blue.svg)](http://opensource.org/licenses/MIT)
Downloads
8
Readme
Screensaver API (for nodejs)
Motivation
A simple screensaver API that enable you to wait for a configured idle time. And stop over user interaction. Detecting user interaction (mostly a system wide API call, is delegated to an external closure). See below for details
API
const ScreenSaver = require('@131/screensaver');
const {getIdleTime} = os.platform() == 'linux' ? require('screensaver-trigger/idle_time_linux') : require('winapi');
const timeout = 60 * 1000; //1min
const screenSaver = new ScreenSaver(timeout, getIdleTime);
screenSaver.on('open', () => {
console.log('screen saver start');
})
screenSaver.on('close', () => {
console.log('screen saver close');
})