changhuixu / session-expiration-alert Goto Github PK
View Code? Open in Web Editor NEWAngular module for session expiration alert
Home Page: https://changhuixu.github.io/session-expiration-alert/
Angular module for session expiration alert
Home Page: https://changhuixu.github.io/session-expiration-alert/
The link with the demo isn't working!
To replicate:
trackSessionTime prevents angular Testability stabilization and should be run outside of angular zone.
Here is proposed patch to fix the issue:
diff --git a/projects/session-expiration-alert/src/lib/components/session-expiration-alert/session-expiration-alert.component.ts b/projects/session-expiration-alert/src/lib/components/session-expiration-alert/session-expiration-alert.component.ts
index fd336f0..4552748 100644
--- a/projects/session-expiration-alert/src/lib/components/session-expiration-alert/session-expiration-alert.component.ts
+++ b/projects/session-expiration-alert/src/lib/components/session-expiration-alert/session-expiration-alert.component.ts
@@ -8,6 +8,7 @@ import {
OnDestroy,
OnInit,
SimpleChanges,
+ NgZone
} from '@angular/core';
import { Subscription } from 'rxjs';
import { SessionInterruptService } from '../../services/session-interrupt.service';
@@ -39,7 +40,8 @@ export class SessionExpirationAlertComponent
constructor(
private el: ElementRef,
private sessionInterrupter: SessionInterruptService,
- public sessionTimer: SessionTimerService
+ public sessionTimer: SessionTimerService,
+ private _ngZone: NgZone
) {}
ngOnInit() {
@@ -60,6 +62,10 @@ export class SessionExpirationAlertComponent
}
private trackSessionTime() {
+ this._ngZone.runOutsideAngular(this.trackSessionTimeOutsideAngular)
+ }
+
+ private trackSessionTimeOutsideAngular() {
this.sessionTimer.startTimer();
this.expired = false;
this.sessionTimerSubscription = this.sessionTimer.remainSeconds$.subscribe(
This is not an issue with the tool but more like a feature request per se. Currently, a modal dialog box is displayed via a built-in service when the session is about to expire. While this is great default functionality and sufficient in most cases, it would be great if there was a way to allow another service to be injected that would get invoked instead; something very similar to how an implementation of SessionInteruptService can be injected.
All in all, great tool. Thanks.
As above
Timer is not running in the background if totalTime is set above 7 minutes. Once the timer is started and open an another tab and come back after 7 minutes, timer is paused in between 5-6 minutes (approx.) and resumes once the tab is active again.
This is not ideal for application which has a server side idleTimeout runs without this issue.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.