@@ -20,9 +20,9 @@ import { ActionPayload } from "./dispatcher/payloads";
2020const UNAVAILABLE_TIME_MS = 3 * 60 * 1000 ; // 3 mins
2121
2222class Presence {
23- private unavailableTimer : Timer | null = null ;
24- private dispatcherRef : string | null = null ;
25- private state : SetPresence | null = null ;
23+ private unavailableTimer ? : Timer ;
24+ private dispatcherRef ? : string ;
25+ private state ? : SetPresence ;
2626
2727 /**
2828 * Start listening the user activity to evaluate his presence state.
@@ -46,22 +46,18 @@ class Presence {
4646 * Stop tracking user activity
4747 */
4848 public stop ( ) : void {
49- if ( this . dispatcherRef ) {
50- dis . unregister ( this . dispatcherRef ) ;
51- this . dispatcherRef = null ;
52- }
53- if ( this . unavailableTimer ) {
54- this . unavailableTimer . abort ( ) ;
55- this . unavailableTimer = null ;
56- }
49+ dis . unregister ( this . dispatcherRef ) ;
50+ this . dispatcherRef = undefined ;
51+ this . unavailableTimer ?. abort ( ) ;
52+ this . unavailableTimer = undefined ;
5753 }
5854
5955 /**
6056 * Get the current presence state.
6157 * @returns {string } the presence state (see PRESENCE enum)
6258 */
6359 public getState ( ) : SetPresence | null {
64- return this . state ;
60+ return this . state ?? null ;
6561 }
6662
6763 private onAction = ( payload : ActionPayload ) : void => {
0 commit comments