ng-sess-timeout
Version:
ng-sess-timeout =======
2 lines • 2.09 kB
JavaScript
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("rxjs")):"function"==typeof define&&define.amd?define("ng-timeout",["exports","@angular/core","rxjs"],t):t(e["ng-timeout"]={},e.ng.core,e.rxjs)}(this,function(e,t,n){"use strict";var i=function(){function e(){var t=this;this.time=1,this.timeExpiredfn=new n.BehaviorSubject(!1),this.timeExpired=this.timeExpiredfn.asObservable(),this.timeLeftfn=new n.BehaviorSubject(this.time/1e3),this.timeLeft=this.timeLeftfn.asObservable(),window.addEventListener("click",function(e){t.start()}),window.addEventListener("scroll",function(e){t.start()}),window.addEventListener("mousemove",function(e){t.start()}),window.addEventListener("keyup",function(e){t.start()})}return Object.defineProperty(e.prototype,"timer",{set:function(e){this.time=60*e*1e3},enumerable:!0,configurable:!0}),e.prototype.start=function(){var e=this;this.timeLeftCalc(),clearTimeout(this.sessionTimer),this.sessionTimer=setTimeout(function(){e.timeExpiredfn.next(!0)},this.time)},e.prototype.stop=function(){clearTimeout(this.sessionTimer)},e.prototype.reset=function(){this.start()},e.prototype.timeLeftCalc=function(){var e=this;clearInterval(this.timeLeftTimer);var t=this.time/1e3;this.timeLeftTimer=setInterval(function(){0<t?(t-=1,e.timeLeftfn.next(t)):clearInterval(e.timeLeftTimer)},1e3)},e.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],e.ctorParameters=function(){return[]},e.ngInjectableDef=t.defineInjectable({factory:function(){return new e},token:e,providedIn:"root"}),e}(),r=function(){function e(){}return e.prototype.ngOnInit=function(){},e.decorators=[{type:t.Component,args:[{selector:"lib-ng-timeout",template:"\n <p>\n ng-timeout works!\n </p>\n ",styles:[]}]}],e.ctorParameters=function(){return[]},e}(),o=function(){function e(){}return e.decorators=[{type:t.NgModule,args:[{imports:[],declarations:[r],exports:[r]}]}],e}();e.NgTimeout=i,e.NgTimeoutModule=o,e.ɵa=r,Object.defineProperty(e,"__esModule",{value:!0})});
//# sourceMappingURL=ng-timeout.umd.min.js.map