title: Ext.EventManager is deprecated in ExtJS 5
body: <p>In ExtJS 5 I'm getting console warning saying</p>
  
  <blockquote>
    <p>[W] Ext.EventManager is deprecated. Use Ext.dom.Element#addListener to
    attach an event listener.</p>
  </blockquote>
  
  <p>I am using code statement bellow,</p>
  
  <pre><code>Ext.EventManager.on(window, 'beforeunload', function() {
      //code here
  });
  </code></pre>
  
  <p>I understand that <code>Ext.EventManager</code> is deprecated but how should I replace my code statement to work it in extjs 5 ?</p>