Skip to content
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

Default event callbacks set to false from documentation throw an error #24

Open
afterbit01 opened this issue Jul 18, 2019 · 10 comments
Open

Comments

@afterbit01
Copy link

afterbit01 commented Jul 18, 2019

Hello, this is my config :

<link rel="stylesheet" src="/assets/jalert/jAlert.css"/>
<script src="/assets/jalert/jAlert.min.js"></script> 
<script src="/assets/jalert/jAlert-functions.min.js"></script> 
 <script src="/assets/jalert/jTimeout.min.js"></script> 
      <script>
          $(function () {
            $.jTimeout({
              flashTitle: true, //whether or not to flash the tab/title bar when about to timeout, or after timing out
              flashTitleSpeed: 500, //how quickly to switch between the original title, and the warning text
              flashingTitleText: '**WARNING**', //what to show in the tab/title bar when about to timeout, or after timing out
              originalTitle: document.title, //store the original title of this page

              timeoutAfter: 60, //pass this from server side to be fully-dynamic. For PHP: ini_get('session.gc_maxlifetime'); - 1440 is generally the default timeout
              heartbeat: 1, //how many seconds in between checking the expiration - warning: changing this can effect your prior countdown warning and timeout - for best results, stick with 1

              extendOnMouseMove: true, //Whether or not to extend the session when the mouse is moved
              mouseDebounce: 30, //How many seconds between extending the session when the mouse is moved (instead of extending a billion times within 5 seconds)
              onMouseMove: false, //Override the standard $.get() request that uses the extendUrl with your own function.

              extendUrl: '/index.xhtml', //URL to request in order to extend the session.
              logoutUrl: '/auto-logout.xhtml', //URL to request in order to force a logout after the timeout. This way you can end a session early based on a shorter timeout OR if the front-end timeout doesn't sync with the backend one perfectly, you don't look like an idiot.
              loginUrl: '/login.xhtml', //URL to send a customer when they want to log back in

              secondsPrior: 30, //how many seconds before timing out to run the next callback (onPriorCallback)
              onPriorCallback: false, //override the popup that shows when getting within x seconds of timing out

              onClickExtend: false, //override the click to extend button callback

              onTimeout: false, //override the timeout function if you'd like
              onSessionExtended: false //override the session extension method (triggered only after a timeout)
            }
            );
            $.jTimeout().getExpiration(); //gets the expiration date string
            $.jTimeout().getSecondsTillExpiration(); //gets the number of seconds until the session expires
          });
      </script>

jQuery 3.4.1 / Chrome v 75.0

i get this error :

jTimeout.min.js:10 Uncaught TypeError: c.options.onPriorCallback is not a function
at countdown (jTimeout.min.js:10)
and then a series of :
jTimeout.min.js:10 Uncaught TypeError: c.options.onMouseMove is not a function
at HTMLBodyElement. (jTimeout.min.js:10)
at HTMLBodyElement.dispatch (jquery.js.xhtml?ln=primefaces&v=7.0.5:2)
at HTMLBodyElement.v.handle (jquery.js.xhtml?ln=primefaces&v=7.0.5:2)

the flashingTitleText: 'WARNING' is showed on the page title

@afterbit01
Copy link
Author

removed all the options above and leave the default options .. the error has disappeared ..

@afterbit01
Copy link
Author

just a question JAlert need Bootstrap?

@HTMLGuyLLC
Copy link
Owner

HTMLGuyLLC commented Jul 18, 2019 via email

@afterbit01
Copy link
Author

I asked for Bootstrap .. because the jAlert texts (ex .. Your session will timeout in ..) appear at the bottom of the html page .. I see the countdown, etc. but not the popup that covers the entire html page

@afterbit01
Copy link
Author

It works!... it was a problem of CSS.. now i review my jTimeout options as suggested before.. thank you!!!.. btw.. great plugin!!! ;-)

@HTMLGuyLLC
Copy link
Owner

HTMLGuyLLC commented Jul 18, 2019

Can you fix your original comment above? The code formatting is only working for half of it. And thanks lol.

@afterbit01
Copy link
Author

yes.. done!

@HTMLGuyLLC
Copy link
Owner

Looks like it doesn't like you passing false for those options: "onPriorCallback" and "onMouseMove".
Just pass an empty function to see if that fixes it. Sorry I took so long to respond and didn't bother looking at my own code/documentation lol. I'm really tied up with stuff.

onMouseMove: function(){ }

or don't pass anything at all and you'll get the default functionality which might be what you're looking for...

@afterbit01
Copy link
Author

Looks like it doesn't like you passing false for those options: "on Prior Callback" and "onMouseMove".

Yes it seems so..
I don't pass anything using the default and it works..

@HTMLGuyLLC
Copy link
Owner

Ok, so the check before running those methods needs to be fixed. Thanks for reporting it. If you have time and want to contribute, please change it and submit a pull request :) Otherwise, I'll update it as soon as I am able.

@HTMLGuyLLC HTMLGuyLLC changed the title jQuery 3.4.1 Default event callbacks set to false from documentation throw an error Jul 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants