share js objects between jquery scripts wrapped in anonymous function

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?

Read more here:: share js objects between jquery scripts wrapped in anonymous function

Leave a Reply

Your email address will not be published. Required fields are marked *