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

fix: bugfix when last() with null value throws exception #35

Closed roupify closed 7 years ago

roupify commented 7 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) LocalStorageExpiry -> last() with null value throws error because null.getTime() doesn't exists

What is the new behavior? Add some validation on parameters to check if param is null. If null, remove key on localStorge, otherwise, set key

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

Coverage Status

Coverage increased (+0.003%) to 99.282% when pulling 5b3d1757ecda48be8b9ee25ced53909e995cea4b on rousseaufiliong:master into 708aa9f1ca7caff944942eb08eaeab5abd446536 on HackedByChinese:master.

coveralls commented 7 years ago

Coverage Status

Coverage increased (+0.04%) to 99.317% when pulling 935ade9ae33ae6641b6bfd475497c8b189d5d8d2 on rousseaufiliong:master into 708aa9f1ca7caff944942eb08eaeab5abd446536 on HackedByChinese:master.

coveralls commented 7 years ago

Coverage Status

Coverage increased (+0.04%) to 99.317% when pulling e99173030e4cb78dabe7ce8bcb743afb6efdda65 on rousseaufiliong:master into 708aa9f1ca7caff944942eb08eaeab5abd446536 on HackedByChinese:master.

roupify commented 7 years ago

Two issues is fix by this pull request. The first one is related by the bug #36. The second one is when we use LocalStorageExpiry and AutoResume.notIdle, onIdleEnd is not emit in each tab. This bug is resolve by adding in the localstorage a key "idling", and our idle will check on storage event if idling value have changed.