title: How to "scope" event listeners?
body: <p>This is my code: </p>
  
  <pre><code>var myFunction(){
      document.addEventListener("deviceready", self.onDeviceReady, false); // scoped event listener
      function onDeviceReady() {
          // ...
      }
  }
  </code></pre>
  
  <p>As far as I see when the event (deviceready) is triggered, the local (to myFunction) callback is run.</p>
  
  <p>However the event listeners is global so another function with the same with global scope may be called as well, once the event is triggered.</p>
  
  <p><strong>How to make not only the callback, but the listener itself locally scoped to a function (I know how to do it for a DOM element but that's different)?</strong></p>