title: How can I maintain dependencies between webcomponents without letting their prototypes enter the global namespace?
body: <p>I've got a number of custom elements defined in an app that I'm working on. Right now, I've been prototyping my elements and have the names sitting in the global namespace. Each element has its own HTML file which I import when I need to create the element. A basic HTML file would look like this:</p>
  
  <pre><code>&lt;script type="text/javascript" src="hello-world.js"&gt;&lt;/script&gt;
  </code></pre>
  
  <p>This points to the following js file:</p>
  
  <pre><code>var helloWorldPrototype = {
      is : "hello-world",
  };
  
  Polymer(helloWorldPrototype);
  </code></pre>
  
  <p>I've got other custom elements which I would then like to have use the prototype of this web component as a base, which I'm accomplishing using the 'behaviors' attribute that Polymer provides. All of the dependencies are imported in the HTML, so my second HTML looks like this:</p>
  
  <pre><code>&lt;link rel="import" href="hello-world.html"&gt;
  &lt;script type="text/javascript" src="hello-earth.js"&gt;&lt;/script&gt;
  </code></pre>
  
  <p>This has the corresponding js contained in <code>hello-earth.js</code>:</p>
  
  <pre><code>var helloEarthPrototype = {
      is : "hello-earth",
      behaviors : [helloWorldPrototype]
  };
  
  Polymer(helloEarthPrototype);
  </code></pre>
  
  <p>My problem is that I would now like to get all of those prototype objects out of the global namespace. For the <code>hello-world</code> component, I can do this by encapsulating my prototype in a self-executing function block, like so:</p>
  
  <pre><code>(function(){
      var helloWorldPrototype = {
          is : "hello-world",
      };
  
      Polymer(helloWorldPrototype);
  })();
  </code></pre>
  
  <p>The problem with this is that <code>helloWorldPrototype</code> is no longer available to <code>helloEarthPrototype</code>. How can I avoid placing the prototypes for my custom elements in the global namespace, but still give them access to one another for inheritance purposes?</p>