title: Difference between document.addEventListener and window.addEventListener?
body: <p>While using PhoneGap, it has some default JavaScript code that uses <code>document.addEventListener</code>, but I have my own code which uses <code>window.addEventListener</code>:</p>
  <pre class="lang-javascript prettyprint-override"><code>function onBodyLoad(){
    document.addEventListener(&quot;deviceready&quot;, onDeviceReady, false);
    document.addEventListener(&quot;touchmove&quot;, preventBehavior, false);
    
    window.addEventListener('shake', shakeEventDidOccur, false);
  }
  </code></pre>
  <p>What is the difference and which is better to use?</p>