ngx-lift 1.7.2 → 1.7.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,116 @@
1
+ import { IdleDetectionConfig } from './idle-detection.config';
2
+ import * as i0 from "@angular/core";
3
+ /**
4
+ * Service for detecting user idle time and implementing a countdown.
5
+ */
6
+ export declare class IdleDetectionService {
7
+ /**
8
+ * The list of interruption events that will end the idle detection.
9
+ */
10
+ private interruptionEvents;
11
+ private interruptionSubscription?;
12
+ /**
13
+ * The default idle duration in seconds (19 minutes).
14
+ */
15
+ private idleDuration;
16
+ /**
17
+ * The default timeout duration in seconds (1 minute).
18
+ */
19
+ private timeoutDuration;
20
+ /**
21
+ * Timer for idle detection.
22
+ */
23
+ private idleTimer?;
24
+ /**
25
+ * Timer for countdown.
26
+ */
27
+ private countdownTimer?;
28
+ /**
29
+ * Flag to indicate if countdown is in progress.
30
+ */
31
+ private isCountingDown;
32
+ /**
33
+ * The current countdown value.
34
+ */
35
+ private countdown;
36
+ /**
37
+ * Subject to emit when idle period ends.
38
+ */
39
+ private idleEndSubject;
40
+ /**
41
+ * Subject to emit the countdown value.
42
+ */
43
+ private countdownSubject;
44
+ /**
45
+ * Subject to emit when countdown ends.
46
+ */
47
+ private countdownEndSubject;
48
+ /**
49
+ * Constructs the IdleDetectionService.
50
+ * @param config - Optional configuration for idle and timeout durations.
51
+ */
52
+ constructor(config: IdleDetectionConfig);
53
+ /**
54
+ * Starts to watch for user inactivity.
55
+ */
56
+ startWatching(): void;
57
+ /**
58
+ * Resets the idle timer when user activity is detected.
59
+ */
60
+ resetTimer(): void;
61
+ /**
62
+ * Sets up the interruption events that will end the idle detection.
63
+ * Listens to a set of events on the document (e.g. click, keydown, mousemove, etc.).
64
+ * When any of these events is triggered, the idle timer is reset.
65
+ * Uses `throttleTime` operator to only trigger the reset when the events are spaced
66
+ * out by at least 1000ms (1 second).
67
+ * @private
68
+ */
69
+ private setupInterruptionEvents;
70
+ /**
71
+ * Starts the idle timer.
72
+ * When the timer expires, it emits an event through onIdleEnd() and starts the countdown.
73
+ */
74
+ private startIdleTimer;
75
+ /**
76
+ * Starts the countdown.
77
+ */
78
+ private startCountdown;
79
+ /**
80
+ * Stops the countdown.
81
+ */
82
+ private stopCountdown;
83
+ /**
84
+ * Returns an observable that emits when the user has been idle for a long period.
85
+ * Developers can use this to perform actions like opening a dialog.
86
+ *
87
+ * user has been inactive for a long period (idleDuration), at this moment, idle detection phase ends, onIdleEnd event is emitted, and then enter countdown/timeout phase.
88
+ * During the countdown phase:
89
+ * - if user has any activity, countdown phase immediately ends and restart the idle detection phase.
90
+ * - else, countdownEnd event will be emitted when timeoutDuration is over.
91
+ * @returns {Observable<void>} - Observable for idle end event.
92
+ */
93
+ onIdleEnd(): import("rxjs").Observable<void>;
94
+ /**
95
+ * Returns an observable that emits when the countdown ends.
96
+ * Usually means the user has been inactive for a very long time and should be logged out.
97
+ * @returns {Observable<void>} - Observable for countdown end event.
98
+ */
99
+ onTimeoutEnd(): import("rxjs").Observable<void>;
100
+ /**
101
+ * Returns an observable that emits the countdown value every second.
102
+ * @returns {Observable<number>} - Observable for countdown value.
103
+ */
104
+ onCountDown(): import("rxjs").Observable<number>;
105
+ /**
106
+ * Clears all timers when the component is destroyed.
107
+ */
108
+ clearTimers(): void;
109
+ /**
110
+ * Sets the idle and timeout durations based on the provided configuration.
111
+ * @param config - Configuration object with idle and timeout durations.
112
+ */
113
+ setConfig(config: IdleDetectionConfig): void;
114
+ static ɵfac: i0.ɵɵFactoryDeclaration<IdleDetectionService, [{ optional: true; }]>;
115
+ static ɵprov: i0.ɵɵInjectableDeclaration<IdleDetectionService>;
116
+ }
@@ -0,0 +1,3 @@
1
+ export * from './idle-detection.config';
2
+ export * from './idle-detection.module';
3
+ export * from './idle-detection.service';
@@ -1,5 +1,6 @@
1
1
  export * from './difference-in-days.util';
2
2
  export * from './form.util';
3
+ export * from './idle-detection';
3
4
  export * from './is-empty.util';
4
5
  export * from './is-equal.util';
5
6
  export * from './omit-by.util';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ngx-lift",
3
- "version": "1.7.2",
3
+ "version": "1.7.3",
4
4
  "description": "A project has been crafted with the goal of enhancing and simplifying your Angular development experience.",
5
5
  "author": "Guanghui Wang <guanghui-wang@foxmail.com>",
6
6
  "peerDependencies": {