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

feat(interruptsource): support ssr with the default interrupt sources #159

Closed un1c0rnr1d3r closed 2 years ago

un1c0rnr1d3r commented 2 years ago

enable lazy initialization of the event target and skip the initialization when rendering on a server platform to avoid unsafe references to window or document

fix #77, #115

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) Library does not support SSR applications.

What is the new behavior? Adds SSR support when using the default interrupt sources and enables custom interrupt sources to potentially support SSR.

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

[ ] Yes
[X] No

Other information: This PR was inspired by the previous PR for SSR support #130. It builds on the previous PR and addresses the problem of creating the default interrupt sources array while rendering on the server without referencing unavailable objects such as document and window.

coveralls commented 2 years ago

Coverage Status

Coverage remained the same at 100.0% when pulling c96f24327396471e67d20f4858d87c88b299ac0e on worksoncloud:ssr-platform into e2af040c3de3332f4a495cd92925d6faf534419b on moribvndvs:master.