1.1.2 • Published 5 years ago

sensor-afk v1.1.2

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

SensorAFK

Donate npm version

Sensor away from keyboard (element)

Sensor AFK was created for Laravel package: rangoo/lockscreen

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Installing

This package can be installed with:

  • npm: npm install --save sensor-afk

Examples

const SensorAFK = require('sensor-afk');

let wasAfk = false;

let sensor = new SensorAFK({
	time: 30,
	sensors: 'click wheel mousemove keydown keyup keypress',
	node: document,
	callback: () => {
		if(wasAfk) {
			alert('You are afk again :/');
		} else {
			alert('You are afk!');
		}
		
		wasAfk = true;
	}
});

// trigger events manually
sensor.flush();
sensor.stop(); // doesn't shut downs sensor. Just waiting next flush
sensor.start();
sensor.afk(); // callback is triggered here

sensor.off(); // turns off sensor
sensor.on(); // turns on sensor
sensor.toggle(); // toggle on/off sensor

Default Options:

{
	time: 30,
	sensors: 'click wheel mousemove keydown keyup keypress',
	node: document,
	callback: () => {
		// default callback does nothing
	}
}

Deployment

Add additional notes about how to deploy this on a live system

Built With

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Authors

  • Guja Babunashvili - Initial work - Guja1501

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the LICENSE file for details

1.1.2

5 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago