1.8.0 • Published 1 year ago

idle-detector v1.8.0

Weekly downloads
-
License
-
Repository
-
Last release
1 year ago

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 directive
  • timeout - Input to the directive which specifies the inactivity duration in milliseconds
  • timedOut - Output from the directive which calls the function after the inactivity duration, here logOut($event) function is called and in the $event the true value will be coming,this logOut($event) will be in the app.component.ts file.