title: javascript android window.onorientationchange fires continuously
body: <p>I'm trying to detect orientation changes on mobile devices and trigger a function once an orientation has been completed, but the code inside the function is continuously firing in Android and I'm not sure why. Here's my code:</p>
  
  <pre><code>var supportsOrientationChange = "onorientationchange" in window;
  var orientationEvent = supportsOrientationChange ? "orientationchange" : "resize";
  
  window.addEventListener(orientationEvent, 
     function() { alert ('orientation changed'); }, 
     false
  );
  </code></pre>
  
  <p>Does anyone know how to write this so that it only triggers once, after orientation change has been completed?</p>