Mainting the state of array across the entire app using singleton pattern
<pre><code>function MySingletonClass(arg) {
  this.arr = [];    
  if ( arguments.callee._singletonInstance )
    return arguments.callee._singletonInstance;
  arguments.callee._singletonInstance = this;    
  this.Foo = function() {
      this.arr.push(arg);
    // ...
  }
}

var a = new MySingletonClass()
var b = MySingletonClass()
Print( a === b ); // prints: true
</code></pre>

<p>My requirement is i am pushing objects to an array on each load of window, but when i open the next window the state of the array is not visible. </p>

<pre><code>var arr = [];
arr.push("something");
</code></pre>

<p>// It gets pushed. </p>

<p>When i open the new window, the array's length becomes zero again. </p>
