Sensor away from keyboard (element)
Sensor AFK was created for Laravel package: rangoo/lockscreen
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.
This package can be installed with:
- npm:
npm install --save sensor-afk
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
}
}
Add additional notes about how to deploy this on a live system
- Laravel Mix - Laravel Mix for compiling files
We use SemVer for versioning. For the versions available, see the tags on this repository.
- Guja Babunashvili - Initial work - Guja1501
See also the list of contributors who participated in this project.
This project is licensed under the MIT License - see the LICENSE file for details