1.8.0 • Published 3 years ago
idle-detector v1.8.0
IdleDetector
Description: This library is created to detect the Inactivity of the User. You can specify the Inactivity timeout in milliseconds.
This library was generated with Angular CLI version 13.3.0.
How to use:
1.Run npm i idle-detector@latest or npm install idle-detector@latest
2.In you project Module file app.module.ts import IdleDetectorModule
//import the idle-detector as follows
import {IdleDetectorModule } from 'idle-detector';3.Then add IdleDetectorModule in the imports:[] of your app.module.ts
//import the idle-detector as follows
@NgModule({
declarations: [
AppComponent,
],
imports: [
IdleDetectorModule,
],
providers: [],
bootstrap: [AppComponent]
})4.Then in the root component 'app.component.html' file add the Directive,Input and output as follow
For Example consider my app.component.html has a div element as a parent element
<div libIdleDetector [timeout]="5000" (timedOut)="logOut($event)" >
..........
..........
</div>In the above code
libIdleDetector- is a directivetimeout- Input to the directive which specifies the inactivity duration inmillisecondstimedOut- Output from the directive which calls the function after the inactivity duration, herelogOut($event)function is called and in the$eventthetruevalue will be coming,thislogOut($event)will be in theapp.component.tsfile.