moribvndvs / ng2-idle

Responding to idle users in Angular (not AngularJS) applications.
https://moribvndvs.github.io/ng2-idle
Apache License 2.0
315 stars 128 forks source link

Re-enter angular2 component cause multiple 'Idle' instance subscribing #48

Closed vincent-cm closed 7 years ago

vincent-cm commented 7 years ago

In my application, there is a necessary to frequently re-visit a core component. I follow the example to reset the idle using idle.watch() every time the component class constructs. The behaviour is wrong so that each visit will create a running instance. Thus multiple onTimeout, onIdleEnd event will fire together when due. Even if I have programmably enforce idle.stop when the component onDestroy.

vincent-cm commented 7 years ago

unsubscribe programmably in OnDestroy