title: My function somehow doesn’t have access to its parent closure & is missing variables. How?
body: <p>In my top-level function, I’m importing some dependencies using require.js. And they’re there, no problem. Within this function, I define a callback function and attempt to use some of the variables imported via require.js, that is, variables within the parent closure.</p>
  
  <p>And they just aren’t there, as confirmed by a breakpoint and a peek at the Chrome inspector’s Scope Variables panel.</p>
  
  <p>I understand that <code>fn.apply</code> and friends only set the context as far as <code>this</code> goes, not that they can destroy a reference to a closure or alter the scope chain.</p>
  
  <pre class="lang-js prettyprint-override"><code>define([
      'backbone',
      'backbone.vent',
      'app/utils/foo',
      'app/services/intent'
  ], function(Backbone, Vent, Foo) {
      'use strict';
  
      // Backbone, Vent, and Foo are defined here
  
      Vent.on('myevent', function(options) {
          // Backbone is defined here, but not Vent or Foo.
      });
  });
  </code></pre>
  
  <p>How is this even possible?</p>
  
  <p>And how can I fix it?</p>