I am re-writing a web app to work in WordPress.
Currently, pages in the app loads one JS file containing a JS object for each “panel” in the page (usually 2 or 3) and a JS object for the page which respond to some events by firing functions in the panels’ objects.
Moving to WordPress, I am wrapping the content of those JS files in an anonymous function so that I can keep using $ as an alias for jquery, but now, since the objects are contained in anonymous function, I cannot access their properties and methods from the JS object which is supposed to handle the whole page.
Is there a way to bring objects declared in anonymous functions to the global scope?
or a way to not use anonymous functions and still be able to use $ instead of jquery in my scripts?