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

Watch intervals should be run outside of main Angular zone #40

Closed b-hobbs closed 6 years ago

b-hobbs commented 7 years ago

I'm submitting a ... (check one with "x")

[ x] bug report => search github for a similar issue or PR before submitting
[ ] feature request
[ ] support request => Please do not submit support request here, instead see https://github.com/HackedByChinese/ng2-idle/blob/master/CONTRIBUTING.md#getting-help

Current behavior

ng2-idle's watching uses setInterval on the main angular zone which is blocking Protractor because it waits until all calls in the main zone are finished.

Expected behavior

setInterval is run outside of the main angular zone so that it doesn't block Protractor.

Minimal reproduction of the problem with instructions

You should be able to add protractor to an app setup for ng2-idle and use protractor --elementExplorer and try to grab an element through Protractor's api.

Workaround Should preferably deal with this inside of the plugin itself.

    this._ngZone.runOutsideAngular(() => {
      this.idle.watch();
    });

    this.idle.onTimeoutWarning.subscribe((countdown: number) => {
      this._ngZone.run(() => { this.sessionEndCountdown = countdown });
    });

What is the motivation / use case for changing the behavior?

Protractor tests don't work

Please tell us about your environment:

OSX EL Capitan 10.11.6 VS Code

xtazy commented 7 years ago

Same problem.

santonica commented 7 years ago

I provided a solution in SO for this and then found this open defect. Please fix this within the ng2-idle. Thx @b-hobbs for opening this issue.

jmurphy87 commented 6 years ago

still experiencing this issue, any solutions yet?

tiboprea commented 6 years ago

Any updates on this issue?

moribvndvs commented 6 years ago

Closed via #74

veneliniliev commented 5 years ago

i have same problem with version 7.0.0-beta.1