title: access variable inside anonymous function from outside
body: <p>The jquery-ui dialog widget is wrapped (just like all other widgets) within an anonymous function.</p>
  
  <p>Inside this function there is a variable declared named <code>sizeRelatedOptions</code>. I need to add a key to that object from outside that wrapping closure. What is the best way to achieve this?</p>
  
  <pre><code>(function( $, undefined ) {
  
      var sizeRelatedOptions = {
          buttons: true,
          height: true,
          //etc
      }
  
      $.widget( "ui.dialog", {
          //widget code
      });
  
  }( jQuery ) );
  </code></pre>
  
  <p>Edit #1: above code is <a href="https://github.com/jquery/jquery-ui/blob/master/ui/jquery.ui.dialog.js#L22" rel="nofollow">source code</a> of jQuery ui</p>
  
  <p><strong>Edit #2</strong>: I now understand that I can't simply access that variable. So I have to work around this. Therefore, here some more information about why I need this:</p>
  
  <p>I am extending jQuery ui's dialog widget to add another buttonPane. To make the widget resize itself once the pane is added to the widget, I wanted to add an option to <code>sizeRelatedOption</code>. (That's what this question first was about.) Because the <code>_options</code> function of the dialog widget checks whether the option exists in <code>sizeRelatedOption</code> as a key. When that is the case it calls the <code>_size</code> function which resizes the widget.</p>
  
  <p>Hopefully I made myself a bit clear.</p>