title: How to get access to a window that is loaded into a panel
body: <p>I'm loading an external script (that creates a new window component) into a panel, which works fine. </p>
  
  <p>Now, I want to access the created window from a callback function to register a <code>closed</code> event handler. I've tried the following:</p>
  
  <pre><code>panel.load({
      scripts: true,
      url: '/createWindow',
      callback: function(el, success, response, options) {
          panel.findByType("window")[0].on("close", function { alert("Closed"); });
      }
  });
  </code></pre>
  
  <p>However, the panel seems to be empty all the time, the <code>findByType</code> method keeps returning an empty collection. I've tried adding events handlers for events like <code>added</code> to the panel but none of them got fired.</p>
  
  <p>I don't want to include the handler in the window config because the window is created from several places, all needing a different refresh strategy.</p>
  
  <p>So the question is: how do I access the window in the panel to register my <code>close</code> event handler on it?</p>