help-watchdog
v1.0.0
Published
Small js package I use to quickly create a timer
Downloads
2
Maintainers
Readme
help-watchdog
Small js package I use to quickly create a timer
Install
$ npm install help-watchdog
Import
This package is pure ESM. It cannot be require()
'd from CommonJS.
Use import foo from 'foo'
instead of const foo = require('foo')
to import the package.
// Load entire build
import Watchdog from 'help-watchdog';
If the package is used in an async context, you could use await import(…)
from CommonJS instead of require(…)
.
You also need to make sure you're on the latest minor version of Node.js. At minimum Node.js 12.20, 14.14, or 16.0.
Read more here: sindresorhus/esm-package
Usage
const wd = new Watchdog(5 * 1000, hidePlayerUI);
const eL = document.addEventListener('mousemove', wd.reset());
wd.start();
This class works like a watchdog timer, if it's not reset before timer finishes it'll trigger a triggerFcn().
License
MIT © Paul Nodet