From 8b79a0f3513b21b745ce834997200b0cb68ac9b8 Mon Sep 17 00:00:00 2001 From: Nicholas Dobie Date: Tue, 24 Sep 2019 10:22:12 -0500 Subject: [PATCH 1/2] feat: Enable the ability to update the time span Allows for the time span to be updated to allow for different idle thresholds depending on application state. --- src/services/IdleSessionTimeout.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/services/IdleSessionTimeout.ts b/src/services/IdleSessionTimeout.ts index 5c10903..31c3dc3 100644 --- a/src/services/IdleSessionTimeout.ts +++ b/src/services/IdleSessionTimeout.ts @@ -82,6 +82,11 @@ export class IdleSessionTimeout implements IIdleSessionTimeout { throw console.error("[idle-session-timeout] element is null or not defined"); } } + + public updateTimeSpan = (timeSpan: number): void => { + this._timeSpan = timeSpan + this.reset() + } private _onTimeOut = (): void => { this.onTimeOut!(); From 788c870642a8758f8d153e486fcfa141168f17e1 Mon Sep 17 00:00:00 2001 From: Nicholas Dobie Date: Tue, 24 Sep 2019 10:24:13 -0500 Subject: [PATCH 2/2] Update readme.md --- readme.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/readme.md b/readme.md index 0b73ebf..b6c6fdd 100644 --- a/readme.md +++ b/readme.md @@ -45,6 +45,9 @@ session.dispose(); // returns time left before time out let timeLeft = session.getTimeLeft(); +// change the time span for idle +session.updateTimeSpan(15 * 60 * 1000); + ``` By default the counter is automatically reset on those events: