ng2-timeout
Creates observables for user idle and timeout with manual interrupts. Detects interrupts across browser tabs with storage-emitter.
Installation
To install this library, run:
$ npm install ng2-timeout --save
Consuming library
Import library in any Angular application from your Angular AppModule
:
;; ; // Import library;
To use the module I recommend injecting the service into your top level app component.
From there you can control what causes interrruptions to the timers and how you want to handle idle or timeout.
; private idleState: string; // if you want to show the countdown for example constructor private idleService: IdleService
Here is an example @HostListener
for detecting keypress
handleKeyboardEventevent: KeyboardEvent
Development
To generate all *.js
, *.js.map
and *.d.ts
files:
$ npm run tsc
To lint all *.ts
files:
$ npm run lint
License
MIT © Jack Jamieson