title: Javascript Event Listener at Interval
body: <p>I'm listening for motion data on devices, using the ondevicemotion API. For example:</p>
  
  <pre><code>window.ondevicemotion = function(event) {
      // do something with the event
  }
  </code></pre>
  
  <p>I want to run this function when I call it; however, because it is based on an event, it triggers when the event does (which, depending on the device, can be often). </p>
  
  <p>How can I adjust the function so it only listens for the event when I call it, rather than continuously?</p>