Recently, I've encountered an issue with a JavaScript file that I'm including on my page. Here's a summary of the situation:
var PageTransitions = (function() {
function setCurrent(currentSet) {
alert(currentSet);
}
function nextPage(options, direction, gotopage) {
//contains some relevant code
}
})();
When using:
PageTransitions.nextPage(x, x, x);
Everything works perfectly fine. However, attempting to utilize
PageTransitions.setCurrent(x);
results in an error message stating "PageTransitions.setCurrent is not a function"
I can't seem to figure out why this is happening, as I believe the syntax is correct. Although I can't share the actual webpage due to work restrictions, our senior developer has reviewed it and confirmed that it should be working. Do you have any insights into what might be causing this issue?
I've tried calling setCurrent after the JavaScript file loads and even moved it after nextPage just to double-check. Interestingly, while nextPage functions properly, setCurrent continues to be unrecognized.
I also attempted renaming both setCurrent itself and the variable being passed to it, but unfortunately, that didn't resolve the problem either.