title: prevent window.onload being overridden javascript
body: <p>How to overcome event handlers being overridden?
  I have a script say a.js</p>
  
  <pre><code>window.onload = function () {
     //Handler in a.js
  }
  </code></pre>
  
  <p>Another script say b.js</p>
  
  <pre><code>window.onload = function () {
     //Handler in b.js
  }
  </code></pre>
  
  <p>where, </p>
  
  <p>a.js is a kind of 3rd party library built by me</p>
  
  <p>b.js is a publisher who uses my script [I can't do any changes out here]</p>
  
  <p>Will onload handler in b.js override a.js's handler?</p>
  
  <p>If yes, How to prevent this from happening?</p>
  
  <p>Will building a queue of all event handlers in a.js and deque them on event help?</p>
  
  <p>But will a.js know all event handlers for an event upfront untill b.js is loaded?</p>
  
  <p>Thoughts and references would help</p>