Skip to content
This repository has been archived by the owner on Apr 21, 2019. It is now read-only.

How to reset the timer on demand? #9

Open
skilledmonster opened this issue Apr 3, 2014 · 2 comments
Open

How to reset the timer on demand? #9

skilledmonster opened this issue Apr 3, 2014 · 2 comments

Comments

@skilledmonster
Copy link

I tried returning the variable TimeoutDialog and calling keepAlive, setupDialog, etc. but it results to multiple timeout dialogs.

Basically, I have several pages in my application that makes ajax calls to the server and refresh the contents of the page. I would want to reset the timer on-demand whenever the ajax call is successfully complete. This is to maintain an active session with the web container.

Any ideas?

@MichaelApproved
Copy link

Have a look at my fork (branch michael-fork). I refactored the code to expose the functions and added the ability to reset the timer. The new code must call the setupDialogTimer directly with the options as a parameter. I also added the ability to pass in a function for when the keep-alive and logout calls are made.

https://github.com/MichaelApproved/timeout-dialog.js/tree/michael-fork

jQuery.timeoutDialog.setupDialogTimer(yourOptionsHere);

To reset, just call the setupDialogTimer() again. If you want to use the same options as before, just call it without the options parameter. It'll use the previously set options

jQuery.timeoutDialog.setupDialogTimer();

If someone is reading this months later and the branch is no longer there, it's likely I merged the changes with my master. I'll polish things off soon and write full docs on my edits.

https://github.com/MichaelApproved/timeout-dialog.js

@evilmoses
Copy link

Hey, just stumbled across this, but before I ask a question, are you still around @MichaelApproved ?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants