
Rather than having main.js manage this, put it into overlay.js, and have the overlay object emit signals that other code can watch to do things when the overlay is showing/shown/hiding/hidden.
Rather than having main.js manage this, put it into overlay.js, and have the overlay object emit signals that other code can watch to do things when the overlay is showing/shown/hiding/hidden.