Yes, thank you. I thought about it, but I wanted to avoid navigating across frames and windows.
a) If the opener is in a frame, and the variable is outside the frame I have to do window.opener.top.foo = "bar". If the javascript that checks for the variable is inside a frame itself, then I have to do top.opener.foo = "bar" or maybe top.opener.top.foo="bar". THe code becomes a bit messy because the person reading the code will have to mentally walkthrough the frames and the popups
b) If I change the layout of the frames, etc, I will find that my javascript code will start breaking
I guess I didn't give sufficient information. I know how to access variables across windows, frames etc. However, I want to avoid explicitly going across windows and frames to get the the variable. As far as possible I would avoid having windows and frames dependent on other windows and frames. I was wondering if there is a well-established pattern that allows multiple frames/popups to share data.
Since, I am more familar with
Java, I was thinking that if I wanted to do something like this in Java, I would have a Singleton pattern coupled with listener pattern. A singleton object can wrap the state of the lock. It can also accept listeners that can be fired whenever the state of the lock changes. So, all the "views" (and I consider the popups and the frames as views) can register to receive the events. Whenever the state of the lock changes, the views will receive the event and update themselves
I am getting stuck because I don't know how to have a singleton object across frames/popups. In Java, if I have static functions, I can access them from anywhere in the same app. So, I can have a static factory method that returns a singleton java object. But, how do I do that in Javascript?