Comments (2)
I actually got this to work pretty easily by making the following change:
https://github.com/wescopeland/ng-idle/commit/a4ed316c60f72abfb9bbf26482d40665dc13924c
Though I am not sure if this is the best approach.
from ng-idle.
There is a setting called autoResume
. I think this feature got away from me, and how it works now is a bug or unexpected feature.
What I had intended is as follows:
- When setting is
true
: If the user is currently idle and the user triggers anactiveOn
event, the idle state will automatically be reset. If the user is not idle, theactiveOn
event(s) will simply reset the idle timer.- The end result is a user will never see a
$idleStart
or$timeout
event so long as they are active within the idle duration, as the timer will continuously be reset. If the user does go idle, but triggersactiveOn
, the idle state will be reset. This is useful if you want a passive and easy way of clearing dialogs, warnings, or errors.
- The end result is a user will never see a
- When setting is
false
: If the user is currently idle and triggers anactiveOn
event, the idle state will not be reset. If the user is not idle, theactiveOn
event(s) will simply reset the idle timer.- The end result here is that once a user goes idle, they cannot come back to the non-idle state unless
watch
is called manually by your application. This is useful if you do not want users to be able to resume using the software once they go idle, or you require a specific action from the user (such as your scenario of requiring the user to enter a password).
- The end result here is that once a user goes idle, they cannot come back to the non-idle state unless
The way it works now:
- When setting is
true
: If the user is currently idle and an event is triggered, the idle state is reset. If the user is not idle, the timer is reset. - When the setting is
false
: The user cannot reset the idle state with an event. If the user is not idle, the timer is not reset and must be done so manually by callingwatch
.
If I were to fix it the way I described at the top, then you could set this to false
, prompt the user for a password if they go idle, and then call watch
when they enter the correct password. Otherwise, their normal non-idle activity will keep resetting the timeout and they can enjoy using the software without being any wiser.
Does that make sense?
from ng-idle.
Related Issues (20)
- [Question] Keepalive event in multiple tabs
- Issue in multiple tabs HOT 2
- Angular 5 - generic component child used in several main component not working
- Not want to reset timer in case of user intervention in app HOT 1
- Any plans to upgrade to Angular 6 HOT 1
- AngularJs - Unknown provider : IdleProvider HOT 1
- ng-Idle/core onIdleStart and onTimout function executing multiple times
- Having issues with ng-idle/core onIdleEnd & Mat-Dialog HOT 1
- keepalive onPingResponse subscribe response doesnt work right
- set url string parameter of http() dynamically
- Using JS Alert does not timeout until OK is Clicked HOT 1
- Key Management: Hardcoded Encryption Key HOT 1
- Select box (with multiple selections) not working properly
- unable to mock inactivity time with cypress clock/tick()
- How to use localstorageservice to handle in multiple tabs in the same browser HOT 1
- Incompatible with Angular 10 HOT 1
- Don't work with IFRAME HOT 3
- Keepalive interval not respected
- Implement a privacy preserving mode functionality avoiding usage of the persistent browser localStorage
- ng-idle not working for iOS in Ionic cordova
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ng-idle.