Is there a way to have your function be called as the LAST in the $(document).ready() queue or, is there a way to trigger an event once this has completed?
I want to essentially see if something was fired by $(document).ready() and, if not, fire it after wards. If I put this code into document ready then there is no guarantee it will execute last so could result in multiple checks.
You can set a global variable when your function is fired, and check that before running it again:
E.g.,
function myFunc()
{
if (myFuncHasFired)
return;
myFuncHasFired = true;
//your func code here
}
This does not guarantee your function will run last, but satisfies what I think is your real requirement that the function not run multiple times in one request.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With