@brggroup/share-lib 0.0.78 → 0.0.80

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.
@@ -129,6 +129,7 @@ var TranslateKey;
129
129
  class AppGlobals {
130
130
  static apiEndpoint;
131
131
  static versionCheck;
132
+ static idleTimeInMinutes; // phút
132
133
  static MENU_TYPE = 'toolbar-menu';
133
134
  static pageSizeOptions = [10, 20, 50, 100];
134
135
  static filterSet = {};
@@ -680,14 +681,20 @@ class AuthService extends HTTPService {
680
681
  return this.postData(AppGlobals.apiEndpoint + URLs$4.register, d);
681
682
  }
682
683
  idleTimer;
683
- idleTimeInMinutes = 15; // phút
684
- idleTime = this.idleTimeInMinutes * 60 * 1000;
684
+ get idleTime() {
685
+ return (AppGlobals.idleTimeInMinutes || 0) * 60 * 1000;
686
+ }
685
687
  startWatching() {
686
- console.log(`-- start watching idle (${this.idleTimeInMinutes} ${this.idleTimeInMinutes == 1 ? 'min' : 'mins'}) --`);
687
- this.resetTimer();
688
- window.addEventListener('mousemove', () => this.resetTimer());
689
- window.addEventListener('keydown', () => this.resetTimer());
690
- window.addEventListener('click', () => this.resetTimer());
688
+ console.log(`-- start watching idle (${AppGlobals.idleTimeInMinutes} min(s) --`);
689
+ if (this.idleTime > 0) {
690
+ this.resetTimer();
691
+ window.addEventListener('mousemove', () => this.resetTimer());
692
+ window.addEventListener('keydown', () => this.resetTimer());
693
+ window.addEventListener('click', () => this.resetTimer());
694
+ }
695
+ else {
696
+ this.stopWatching();
697
+ }
691
698
  }
692
699
  resetTimer() {
693
700
  if (this.idleTimer) {