idle-detector
Version:
[Description:] This library is created to detect the Inactivity of the User. You can specify the Inactivity [timeout] in [milliseconds].
107 lines (99 loc) • 4.76 kB
JavaScript
import * as i0 from '@angular/core';
import { Injectable, Component, EventEmitter, Directive, Input, Output, NgModule } from '@angular/core';
class IdleDetectorService {
constructor() { }
}
IdleDetectorService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: IdleDetectorService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
IdleDetectorService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: IdleDetectorService, providedIn: 'root' });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: IdleDetectorService, decorators: [{
type: Injectable,
args: [{
providedIn: 'root'
}]
}], ctorParameters: function () { return []; } });
class IdleDetectorComponent {
constructor() { }
ngOnInit() {
}
timeoutDetected(event) {
alert("timedout");
}
}
IdleDetectorComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: IdleDetectorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
IdleDetectorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: IdleDetectorComponent, selector: "lib-idle-detector", ngImport: i0, template: `
<p>
idle-detector works!
</p>
`, isInline: true });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: IdleDetectorComponent, decorators: [{
type: Component,
args: [{
selector: 'lib-idle-detector',
template: `
<p>
idle-detector works!
</p>
`,
styles: []
}]
}], ctorParameters: function () { return []; } });
class IdleDetectorDirective {
constructor() {
this.timedOut = new EventEmitter();
}
ngOnInit() {
this.inactivityTime();
}
inactivityTime() {
window.onload = this.resetTimer;
document.onmousemove = this.resetTimer.bind(this);
document.onkeypress = this.resetTimer.bind(this);
}
resetTimer() {
clearTimeout(this.timer);
this.timer = setTimeout(() => {
this.timedOut.emit('true');
}, this.timeout);
}
}
IdleDetectorDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: IdleDetectorDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
IdleDetectorDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.12", type: IdleDetectorDirective, selector: "[libIdleDetector]", inputs: { timeout: "timeout" }, outputs: { timedOut: "timedOut" }, ngImport: i0 });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: IdleDetectorDirective, decorators: [{
type: Directive,
args: [{
selector: '[libIdleDetector]'
}]
}], ctorParameters: function () { return []; }, propDecorators: { timeout: [{
type: Input
}], timedOut: [{
type: Output
}] } });
class IdleDetectorModule {
}
IdleDetectorModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: IdleDetectorModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
IdleDetectorModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: IdleDetectorModule, declarations: [IdleDetectorComponent,
IdleDetectorDirective], exports: [IdleDetectorComponent,
IdleDetectorDirective] });
IdleDetectorModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: IdleDetectorModule, imports: [[]] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: IdleDetectorModule, decorators: [{
type: NgModule,
args: [{
declarations: [
IdleDetectorComponent,
IdleDetectorDirective
],
imports: [],
exports: [
IdleDetectorComponent,
IdleDetectorDirective
]
}]
}] });
/*
* Public API Surface of idle-detector
*/
/**
* Generated bundle index. Do not edit.
*/
export { IdleDetectorComponent, IdleDetectorDirective, IdleDetectorModule, IdleDetectorService };
//# sourceMappingURL=idle-detector.mjs.map