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

Run outside angular #88

Closed sliekens closed 6 years ago

sliekens commented 6 years ago

Please check if the PR fulfills these requirements

What kind of change does this PR introduce? (check one with "x")

[x] Bugfix
[ ] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Other... Please describe:

What is the current behavior? (You can also link to an open issue here) Angular spies on every event handler that is attached to the document root element and processes change detection whenever an event is dispatched by the browser. That's pretty bad for performance.

What is the new behavior? This PR changes InterruptSource to attach event handlers outside the Angular zone so that no change detection is processed for each event.

Does this PR introduce a breaking change? (check one with "x")

[ ] Yes
[x] No

If this PR contains a breaking change, please describe the impact and migration path for existing applications: ...

Other information:

coveralls commented 6 years ago

Coverage Status

Coverage increased (+0.004%) to 99.358% when pulling c94fc9a93a27a716b3598bcdb4fca7df083bf6ee on StevenLiekens:feature/run-outside-angular into 2e1aaaf5dfa380844a2b5a2aeec47981fd7f9826 on HackedByChinese:master.

wesley-trantham commented 6 years ago

I just tested this with mine, and it looks to fix the issue I have in #78 with the (click) event not firing. Very awesome!

sliekens commented 6 years ago

Sweet. :)

moribvndvs commented 6 years ago

Thanks!