moribvndvs / ng2-idle

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

Feature/run outside angular #85

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 EventTargetInterruptOptions 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.003%) to 99.356% when pulling b502b084db6270e9ea7e3525230021d7375a0968 on StevenLiekens:feature/run-outside-angular into 2e1aaaf5dfa380844a2b5a2aeec47981fd7f9826 on HackedByChinese:master.

sliekens commented 6 years ago

Coverage increased (+0.003%)

Slowly paying it back. 😁

sliekens commented 6 years ago

Something is still triggering ngDoCheck on every mousemove in a real application