ngIdle - How to clear and reset interrupts in Angular

℡╲_俬逩灬. 提交于 2019-12-31 05:37:25

问题


I have integrated ngidle library in my app and i am showing dialog with timeout value . I would like to stop the timer value only on interactions on the dialog . not on the screen so on nginit i have set the default interrrupts and on timeout warning i am clearing the interrupts but i am not able to reset the interrupts .

The sample code is below , Please check and let me know if anything goes wrong .

 ngOnInit() {

// sets the default interrupts, in this case, things like clicks, scrolls, touches to the document
this.idle.setInterrupts(DEFAULT_INTERRUPTSOURCES);
  }

this.idle.onTimeoutWarning.subscribe((countdown) => {

  this.idle.clearInterrupts();
  console.log('count down value' + countdown);
  this.dataService.changeVersionSelectionData(countdown);

});

this.idle.onIdleEnd.subscribe(() => {

  this.idle.setInterrupts(DEFAULT_INTERRUPTSOURCES);

});

来源:https://stackoverflow.com/questions/57866420/ngidle-how-to-clear-and-reset-interrupts-in-angular

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!