-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FEATURE REQUEST] Programatically update IDLE_TIMEOUT
value from my app
#56
Comments
Looking at the code, it seems you may be able to just do |
@elwayman02 Seems like that should work but the timing is off. Here's a crude twiddle https://ember-twiddle.com/0faf8804c209997652670c88213d2e23?openFiles=components.auth-session-timeout.js%2C
Open the twiddle and the console panel. Now click on the The
throttle call in services/user-activity.js triggers 'userActive' on the initial click of the {{link-to}} before the transition occurs
I tested this with and without eaglerly loading the service and I experience the same behavior. I also tested firing the set within the I have a local repo with some additionall logging here and you can see the order // click /dashboard from /login-flow route
user-activity.js:93 TRIGGER `userActive` from service:user-activity#fireEvent
user-idle.js:45 resetTimeout triggered. IDLE_TIMEOUT= 10000
// note resetTimeout has already been triggered before the route hooks fire
dashboard.js:9 SETTING userIdle.IDLE_TIMEOUT=5000 from route:dashboard#activate |
I was playing around with this a little more tonight and I have a workaround, Anytime an app wants to set updateIdleTimeoutValue() {
set(this, 'userIdle.IDLE_TIMEOUT', myNewTimeoutValue);
// This line is necessary to properly clear out the "stale" previous value
get(this, 'userIdle').resetTimeout();
} It could be useful as a future enhancement to provide an interface to the user like Updated the previous twiddle with the workaround for anyone looking for a solution. https://ember-twiddle.com/0faf8804c209997652670c88213d2e23 |
I think this is a good future enhancement, going to reopen so it doesn't get lost! I'm glad you found a workaround for now, I'll definitely put this into the next release of the addon if possible. |
I have a domain specific issue that doesn't seem to fit into the current allowable configurations for this addon.
My use case would be to have a way to programatically change the
IDLE_TIMEOUT
value from my consuming application based on some application state flag. I have a part of my app where the timeout is one value, then another part of my app where the timeout is a different value...I was hoping to use the same service for both and be able to change the timeout valueSimple example: Lets say I'm in my consuming application. I have overwritten your addon's default
IDLE_TIMEOUT
value by simple extending your service and set it to 1 minute. Now I'm on route/foo
where theIDLE_TIMEOUT
still equals my default 1 minute...but when I navigate to route/bar
I need to update my overwrittenIDLE_TIMEOUT
value yet again to 2 minutes.Let me know if I'm simply overlooking anything or if there would be a way to allow more configurable behavior here. If there's anything I can do to help let me know. Thank you!
/cc @crodriguez1a
--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/37424509-feature-request-programatically-update-idle_timeout-value-from-my-app?utm_campaign=plugin&utm_content=tracker%2F34204874&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F34204874&utm_medium=issues&utm_source=github).The text was updated successfully, but these errors were encountered: