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): allow interrupts to use an ssr option #130

Closed moribvndvs closed 2 years ago

moribvndvs commented 4 years ago

ssr option instructs interrupt sources to ignore targets derived from global context such as window or document so they can be safely used in ssr/universal apps.

If you are using ssr/universal, do not use DEFAULT_INTERRUPTSOURCES. Instead, use createDefaultInterruptSources({ssr: !isPlatformBrowser(platformId) }). See docs or https://stackoverflow.com/a/46893433/64750 for information on how to use isPlatformBrowser.

Fixes #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)

No support for SSR/Universal apps.

What is the new behavior? Adds an opt-in option when creating interrupt sources that will allow compatibility with SSR/universal.

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 4 years ago

Coverage Status

Coverage remained the same at 100.0% when pulling ca8d68bf9900fa9cc1d15e0e86babad1acb7eb0a on ssr into db0148bcb27337deaac5b8828466e39bc0e755cf on master.