title: Using listenTo in Backbone and RequireJS
body: <p>So before using RequireJS, I had the following code below that worked fine and pulled in the Posts from from the server rather than a .fetch() call...Given the modular pattern of RequireJS and the fact that I can't have this nice app.posts variable floating around for other files, is there a way to still use the $(document).ready function and have the posts variable still respond to the 'reset' event?  Currently, I am only getting this to work with .fetch (see below).</p>
  
  <p>routes.js</p>
  
  <pre><code>router.get('/fund', function(req, res) {
    Post.find({}, function(err, docs) {
      res.render('fund', {
        posts: docs //passed to bootstrapPosts in script element
      });
    });
  });
  </code></pre>
  
  <p>index.jade</p>
  
  <pre><code>var bootstrapPosts = !{JSON.stringify(posts)};
  </code></pre>
  
  <p>collections.js</p>
  
  <pre><code>app.posts = new app.PostCollection(); //app. == namespacing
  </code></pre>
  
  <p>app.js</p>
  
  <pre><code>$(document).on('ready', function() {
    app.post_appView = new app.postAppView(); 
    app.posts.reset(bootstrapPosts);
    app.posts.fetch(); //**Don't want to use this**//
  });
  </code></pre>
  
  <p>post_appView.js</p>
  
  <pre><code>initialize: function() {
      this.listenTo(app.posts, 'reset', this.addAll);
  }
  </code></pre>
  
  <p>=====</p>
  
  <p>With RequireJS</p>
  
  <p>AppView.js</p>
  
  <pre><code>define([
    'jquery',
    'underscore',
    'backbone',
    'models/models',
    'views/postView',
    'collections/collections',
    'globals'], function($, _, Backbone, PostModel, PostView, posts, globals){
  
     return AppView = Backbone.View.extend({
        el: '#securities',
        initialize: function() {
          this.listenTo(posts, 'add', this.addOne);
          this.listenTo(posts, 'reset', this.addAll);
          posts.fetch({reset: true}); // I DON"T WANT TO USE THIS.
        },
  </code></pre>