Can be used to transition away from sensitive on screen information and redirect to another page. Useful when a user forgets to close their browser or tab before walking away from their computer.
npm install inactivity-countdown-timer --save
// Optional config vars
let settings = {
idleTimeoutTime?: number;
startCountDownTimerAt?: number;
resetEvents?: string[];
timeoutCallback?(): void;
countDownCallback?(secondsLeft: number): void;
countDownCancelledCallback?(): void;
localStorageKey?: string;
redirectHREF?: string;
}
// Instantiate new logout object
let IL = new InactivityLogout(settings);
// make sure you cleanup the object when you are finished using it.
// will not be garbage collected unless you clean it up because of the timers
IL.cleanup()
See the demo code for a detailed example
run npm start
to view the demo locally
By default the inactivity timeout is reset by these events:
The project is setup with both main.ts used for exporting the library and a demo.ts used to demo components and setup testing.
npm install
installs node modules and runs tests
npm start
runs a development servernpm test
runs the tests via karma (from the main ts file) npm test-via-saucelabs
runs the tests via karma against Saucelabs config(from the main ts file) npm build
builds a version for distribution via npmnpm test
npm install '/path-to-this/'
git tag -a v0.1.5 -m "Published v0.1.5"
git push origin --tags
npm publish
Make sure you are importing the included ie8EventListenerPolyfill when supporting ie8.
This module was originally published with support from Benefex. Benefex
Generated using TypeDoc